vBulletin

Thank you for visiting. This is our website archive. Please visit our main website by clicking the banner above.
vBulletin FAQ is dedicated to helping the forum owner build, manage and profit from his vBulletin Forum
vBulletin Web Hosting - Free skins and styles for your vBulletin - Search Engine Optimization




Trying to sort a conditional for changing the alt text for an image url

theMusicMan
03-20-2005, 12:45 PM
OK, here's the lowdown. I am adding an image url as a custom field in the Links Directory and am parsing that field as the source for an image to be displayed in the View Link page.

This works fine as the image can be seen in this View Link page here...

http://www.themouthpiece.com/links/...howdetails&l=98 (http://www.themouthpiece.com/links/showlink.php?do=showdetails&l=98)

However... what I want to be able to do is check for the existence of an image in the field and if there is one there, display some alt"" text for mouse over image, but if there is no image URL there (ie: the field is empty) I want to display alternative alt"" text. I am using a conditional thus;

<td>
<a href="showlink.php?$session[sessionurl]l=$link[linkid]&linkurl=$link[url]" target="_blank">
<img
<if condition="$field2">
alt="$link[name]... courtesy of the tMP Links Directory"
<else />
alt="No URL supplied for a 100 * 100 thumbnail. Please enter one here..."
</if>
border="0" src="$field[value]" width="100" height="100"></a>
</td>

However... I can't get the conditional to work and to change the alt text. What am I doing wrong here....?

theMusicMan
03-20-2005, 01:41 PM
Here's the full template....

<tr class="$bgclass">
<td valign="top">$field[title]:
<if condition="$thisfield == 'field2'">
<td>
<a href="showlink.php?$session[sessionurl]l=$link[linkid]&linkurl=$link[url]" target="_blank">
<img
<if condition="field2">
alt="$link[name]... courtesy of the tMP Links Directory"
<else />
alt="No URL supplied for a 100 * 100 thumbnail. Please enter one here..."
</if>
border="0" width="100" height="100" src="$field[value]"></a>
</td>
<else />
<td>$field[value]
</if>
</tr>

noppid
03-20-2005, 01:41 PM
show more

noppid
03-20-2005, 01:53 PM
<tr class="$bgclass">
<td valign="top">$field[title]:
<if condition="$thisfield == 'field2'">
<td> <a href="showlink.php?$session[sessionurl]l=$link[linkid]&linkurl=$link[url]" target="_blank">
<img <if condition="$field2"> alt="[$field2]-$link[name]... courtesy of the tMP Links Directory"
<else /> alt="[$field2]-$No URL supplied for a 100 * 100 thumbnail. Please enter one here..."
</if> border="0" width="100" height="100" src="$field[value]"></a>
</td>
<else />
<td>$field[value]</td>
</if>
</tr>

noppid
03-20-2005, 02:13 PM
After reading everthing, I think ya need this...


<tr class="$bgclass">
<td valign="top">$field[title]:</td>
<if condition="$thisfield == 'field2'">
<td><a href="showlink.php?$session[sessionurl]l=$link[linkid]&linkurl=$link[url]" target="_blank">
<if condition="$field[value]"><img alt="$link[name]... courtesy of the tMP Links Directory"
border="0" width="100" height="100" src="$field[value]" />
<else />$link[name]
</if>
</a>
</td>
<else />
<td>$field[value]</td>
</if>
</tr>

theMusicMan
03-20-2005, 04:02 PM
Greg: you're a superstar mate... thanks a million for all your help, enthusiasm and encouragement in getting this issue sorted. I am very grateful.

All: I have now updated the view/show links pages to include a parsed text field that shows a thumbnail image of the site that has been submitted. This is hopefully the first step in a long stairway that will eventually get me to being able to have the code take the snapsot itself and update the record accordingly.

It is a manual process just now, either the user can enter a URL for a 100*100 image to be used as the thumbnail screenshot, or I or one of my team of Mods can do this. I have managed to get it to show the image if a URL pointing to one is entered, and some alternative text if not.

Next step is to try to get this working on the browselinks page where there are many links shown in summary in a list... t'would be great to have that same image in a new column associated with each listed link. This needs some ammendments to the calling php file as the variables are not called from that file and they need to be to be shown on the template.

Joey: Why not add your link...??

theMusicMan
03-21-2005, 02:37 PM
Update:

OK, I have - with the superb help this time from Colin_F (mod from vB.org) - now managed to show the image thumnails for all links shown when browsing any category and I think this looks really cool.

Take a look here - http://www.themouthpiece.com/links/browselinks.php?do=newlinks

Feedback...:)

noppid
03-21-2005, 03:07 PM
Nice job.


vBulletin

seo book

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum