View Full Version : Custom Fields != Image URLS ?
Shelby
01-02-2007, 08:01 AM
I've tried adding a custom field to my "adv_links_linkbit" template with no luck. What I'm trying to do is add:
<div style="float: left; padding-left: 4; padding-right: 8; padding-top: 3; padding-bottom: 3"><img border="0" src="$links[field3]" width="150" height="75"/></div>
To my postbit. Where field3 is a URL to a banner. All I get though is a red X. Was wondering how I can fix the red X issue and add a conditional that if field3 = blank then display X.
Brian
01-02-2007, 11:39 AM
<if condition="$link['field3']"> </if>
Shelby
01-02-2007, 02:23 PM
I tired that and for some reason it doesn't work.
I've got. A custom profile field3 where users can enter a URL to an image.
<if condition="$link['field3']">
<img border="0" src="$links[field3]" width="150" height="75"/>
</if>However, nothing shows up when I use the if conditional and if I don't use the if conditional all I get is a red X.
Correction, I can see the banner when accessing browselinks.php, or viewing a directory, however on the index.php I get red X's.
Brian
01-03-2007, 04:25 PM
You'd need to modify your index.php file so that the new and random links sections will also pull the custom fields. If you look in that file for this code:
$querycols = implode(', ', $querycols);
And add this right Above it:
$querycols[] = 'field3';
$queryjoin .= ' LEFT JOIN ' . TABLE_PREFIX . 'adv_links_cfields_entries AS customfields ON (links.linkid = customfields.lid)';
Then that should do the trick.
Shelby
01-04-2007, 11:52 AM
Sweet.
calord
05-21-2007, 12:40 PM
This didn't work for me. I still get the red x. Probably because the following code is not in my index.php file:
$querycols = implode(', ', $querycols);
I searched and did *not* find it. Any help?
Brian
05-22-2007, 03:09 PM
Search for this code instead:
$privcats = fetch_private_categories();
And then add this right above:
$querycols .= ', field3';
$queryjoin .= ' LEFT JOIN ' . TABLE_PREFIX . 'adv_links_cfields_entries AS customfields ON (links.linkid = customfields.lid)';
calord
05-22-2007, 05:06 PM
Thank you for your reply :)
But I still get the red x. Also, the logo just kind of squeezes itself into the link name column. Is there a way I can add a column for the logo?
The most important thing is to solve that red x. The images aren't showing. Could it be that I haven't pasted this code in the correct place of the adv_links_linkbit? It wasn't specified where to put it:
<if condition="$link['field1']">
<img border="0" src="$links[field1]" width="150" height="75"/>
</if>
Brian
05-22-2007, 05:12 PM
Does the image appear correctly when viewing a link? You don't seem to have anything entered for any custom fields in the link on your site...
calord
05-22-2007, 05:16 PM
It doesn't show when viewing the link either.
I setup a custom field. It's there. Not sure what you mean.
Brian
05-22-2007, 05:19 PM
You have to actually add the URL to the image in that field when submitting/editing a link.
calord
05-22-2007, 05:23 PM
Into the custom field? That's what I'm doing. I'm getting a red x.
Is that what you mean??
Brian
05-22-2007, 05:45 PM
Edit the link that you've submitted, and add the URL to your image in the place for the custom field you've added. Otherwise, if there's nothing entered, then there's nothing to display.
calord
05-22-2007, 06:20 PM
As I've said, that data *is* entered. In the custom field which I created for banners and logos, I have placed the URL to the *image*. Red box.
I have done everything in this thread. You never answered the question about the placement of the code and if that has anything to do with the problem.
I don't know why I'm getting red x for images. They are there, but they are not showing up on browselinks.php, index, or the link details.
calord
05-22-2007, 06:22 PM
Here just look at the links for yourself.
http://tsw.kaystreet.net/links
calord
05-23-2007, 02:18 PM
Help?
Brian
05-23-2007, 02:51 PM
Check your PMs.
Statice
07-24-2007, 02:18 AM
Hi, i just tried this mod...got it working perfectly...
then i refreshed like 2minutes later and got a database error..
Invalid SQL:
SELECT links.linkid, name, description, linkurl, links.catid, username, links.userid, views, open, dateline, votenum, votetotal, NOT ISNULL(subscribelink.linkid) AS subid, posts, links.lastpostid, links.lastpostdateline, links.lastpostuserid, links.lastpostusernamefield1field2
FROM adv_links AS links
LEFT JOIN adv_links_subscribelink AS subscribelink ON (links.linkid = subscribelink.linkid AND 1 = subscribelink.userid) LEFT JOIN adv_links_cfields_entries AS customfields ON (links.linkid = customfields.lid) LEFT JOIN adv_links_cfields_entries AS customfields ON (links.linkid = customfields.lid)
WHERE valid = 1 AND suspended = 0
ORDER BY dateline DESC
LIMIT 5;
MySQL Error : Not unique table/alias: 'customfields'
Statice
07-24-2007, 02:23 AM
hmm ...
i just took out the code from index.php and i went back in to see what fields were missing...
and they were all there still...how is that possible?
sorry for another edit....
okay so i've got everything working fine in the categories...
but on the main page...the 5 latest and 5 most popular dont display any of the custom fields...
can i edit that somewhere?
Thanks,
Statice
roymogg
07-27-2007, 09:13 AM
Can I ask the location in the adv_links_linkbit code - the proceeding line - to which this code was added.
Cheers Roy
I've tried adding a custom field to my "adv_links_linkbit" template with no luck. What I'm trying to do is add:
<div style="float: left; padding-left: 4; padding-right: 8; padding-top: 3; padding-bottom: 3"><img border="0" src="$links[field3]" width="150" height="75"/></div>
To my postbit. Where field3 is a URL to a banner. All I get though is a red X. Was wondering how I can fix the red X issue and add a conditional that if field3 = blank then display X.
Statice
08-11-2007, 08:29 PM
okay so i've got everything working fine in the showlinks page...
but on the index page...the 5 latest and 5 most popular dont display any of the custom fields...
this is my code on adv_links_linkbit
<if condition="$vba_options['links_allowreplies']">
<div style="font-size:11px;">
$link[field2] | $link[field1]
</div>
<else />
<span class="smallfont">$link[description]</span>
</if>
what am i doing wrong??
- Statice
Brian
08-21-2007, 07:20 PM
Looks like you've added part of the code twice, as the LEFT JOIN statement there is appearing twice.
Make sure you're using this exact code:
$querycols .= ', field1, field2';
$queryjoin .= ' LEFT JOIN ' . TABLE_PREFIX . 'adv_links_cfields_entries AS customfields ON (links.linkid = customfields.lid)';
vBulletin® v3.7.2, Copyright ©2000-2008, Jelsoft Enterprises Ltd.