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)';
Hi-Jack
09-14-2009, 10:08 AM
Brian, I tried this procedure but the images don't whos up. I'm sure i'm overlooking something (need some decent guides on these mods). What I get after applying the procedure described in here, is a DB Error:
Database error in vBulletin 3.8.4:
Invalid SQL:
SELECT links.linkid, name, description, linkurl, links.catid, username, links.userid, views, open, dateline, lastupdated, votenum, votetotal, customfields.*, posts, links.lastpostid, links.lastpostdateline, links.lastpostuserid, links.lastpostusername, NOT ISNULL(favorites.linkid) AS isfavorite, field5
FROM vbut_adv_links AS links
LEFT JOIN vbut_adv_links_cfields_entries AS customfields ON(links.linkid = customfields.lid) LEFT JOIN vbut_adv_links_favorites AS favorites ON (favorites.linkid = links.linkid AND favorites.userid = 1) LEFT JOIN vbut_adv_links_cfields_entries AS customfields ON (links.linkid = customfields.lid)
WHERE valid = 1
ORDER BY dateline DESC
LIMIT 5;
MySQL Error : Not unique table/alias: 'customfields'
Error Number : 1066
Request Date : Monday, September 14th 2009 @ 02:46:14 PM
Error Date : Monday, September 14th 2009 @ 02:46:14 PM
Script : http://dev.mpcclub.com/links/
Referrer : http://dev.mpcclub.com/links/europe-based-3/
IP Address : 212.190.70.7
Username : Hi-Jack
Classname : vB_Database
MySQL Version : 5.0.81-community
Here's what I did:
Editted the adv_link_linkbit template and tried placing the following in all position possible as a test:
<if condition="$link['field5']">
<div style="float: left; padding-left: 4; padding-right: 8; padding-top: 3; padding-bottom: 3"><img border="0" src="$links[field5]" width="150" height="75"/></div>
</if>
I editted my links/index.php:
right above:
$privcats = fetch_private_categories();
i inserted:
$querycols .= ', field5';
$queryjoin .= ' LEFT JOIN ' . TABLE_PREFIX . 'adv_links_cfields_entries AS customfields ON (links.linkid = customfields.lid)';
Loading the page still works but i get the db error above...
What I did is create a custom TEXT field where i enter the FULL HTTP URL of the image I want to show... I'd appreciate the help. Someone posted the error before but did not post the solution stating "working now" so i'm hopefully for this to work for me as well...
In the end, i'd prefer even an IF clause that does not "render" the thumnail automatically if an image is selected here... like...
if field5 is entered
show image in field5
else
render auto thumbnail
endif
I would prefer reaching that kind of solution instead of showing an extra picture...
Hi-Jack
09-14-2009, 11:42 AM
And an update...
Despite following the previous guides to the letter and not coming to a solution, i found the tip about changing the linkurl to the field where you'd enter the screenshot. This works however not as described.
Description: Create a custom field where you enter the URL to the page you want to take the screenshot from.
When doing so and edit the link to have this URL field, it is stored in the DB between BB tags and therefore does not function. I did the same thing as described but created a selection list instead as custom field with the URLS I need selecteable and this worked flawless...
I'd still wish for a better solution (see above) where the routine is changed in an If Then Else procedure...
Hi-Jack
09-15-2009, 02:38 AM
I feel as i'm coming over impatient but trust me, i'm not :-)
Ok, what I did to break loose from the fact I could not enter files and add a custom URL is as follows, adjusting both templates for the linkbits and showbits templates. Custom Field: field5 (in your case, change 5 to whatever ID you have assigned to your custom field)
- adminCP -> Style - Edit Templates -> vBadvanced Links Directory Templates -> adv_links_linkbit
Changed:
"<if condition="$show['nofollow']"> rel="nofollow"</if>><img alt="$link[name_nohighlight]" src="http://open.thumbshots.org/image.aspx?url=$link[linkurl]" width="120" height="90" border="0" /></a>
To:
"<if condition="$show['nofollow']"> rel="nofollow"</if>><img alt="$link[name_nohighlight]" src="http://open.thumbshots.org/image.aspx?url=$link[field5]" width="120" height="90" border="0" /></a>
- adminCP -> Style - Edit Templates -> vBadvanced Links Directory Templates -> adv_LINKS_SHOWLINKS
Changed:
<if condition="$show['nofollow']"> rel="nofollow"</if>><img alt="$link[name_nohighlight]" src="http://open.thumbshots.org/image.aspx?url=$link[linkurl]" width="120" height="90" border="0" /></a></td>
</if>
TO:
<if condition="$show['nofollow']"> rel="nofollow"</if>><img alt="$link[name_nohighlight]" src="http://open.thumbshots.org/image.aspx?url=$link[field5]" width="120" height="90" border="0" /></a></td>
</if>
Now it won't work like this just because the URL you enter is stored in the DB with BB Tags (adv_links_cfields_entries like:
[ url ]link[ /url ].
We created a little script for this that can be ran at any time manually or propbably can be scheduled in cron and removes these BBCode parts of this specific field only so links become properly stored without bbcode tags and can be used by the system. Then it works on both the list and details view to add a custom URL to your links directory.
In case you enter websites, you have to enter the address twice, once for the link and once for the screenshot were in case of files, you can add the file link for download and set any URL it needs to take a screenshot from.
That did it and felt better than editting whatever pages necessary. This makes it more easy to upgrade later on as well as we only changes two soft keys in the templates.
Hope it helps someone else as well.
Brian:
I would dare hope custom images will become supported eventually and an option in Setup is provided to select whatever custom field should be used as a thumbshots target. In addition, the entry of text fields should be stored "exactly" as the user enters it for these custom fields and not changed into bbcode. It would expand the useability of this tool so much it can be used for all kinds and files and not just links. That's where it would become "advanced" as the currently it's not im my humble opinion. It took me a little by surprise... but we got to the finish line eventually and hope for the best in the future...
I appreciate your endless efforts up here and providing these great tools and hope you'll make use of more potential in the future...
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.