PDA

View Full Version : Switch thumbs


omaron
02-01-2007, 03:26 PM
I display thumbs using an older mod, using msn instead of Thumbshots.org because i think msn has thumbs for more sites and make thumbs for new sites faster.

In my link-display.tpl i have this, right at top:

<tr>
<td valign="top" style="padding-right: 10px;"><a href="{$link.url}" class="cat-url">
<img border="0" width="120" height="94" src="http://msnsearch.srv.girafa.com/srv/i?s=MSNSEARCH&r={$link.url}" /></a></td>
<td colspan="2" class="link {$link.status}"{if $link.featured AND $config.featured_highlight AND $config.featured_links} style="background-color: {$config.featured_highlight}"{/if}{if $link.partner AND $config.partner_highlight AND $config.partner_links} style="background-color: {$config.partner_highlight}"{/if}{if $link.sponsored AND $config.sponsored_highlight AND $config.sponsored_links} style="background-color: {$config.sponsored_highlight}"{/if}>


Also, i let people to submit link to a hotlinkable thumb. So i made a new listing field, something like this (this is not a required field):

Title Name Field Type Field Length Order
Thumbnail URL (120x100) Thumbnail text 100 1,2


What i would like to do, is to display this submited thumbnail whenever it exist, and if not exist (was not submited) to display the msn thumb.

How could i do this?

Dave Baker
02-01-2007, 05:05 PM
Hello omaron,
***Open templates/yourTemplate/link-display.tpl and find code***

<tr>
<td valign="top" style="padding-right: 10px;"><a href="{$link.url}" class="cat-url">
<img border="0" width="120" height="94" src="http://msnsearch.srv.girafa.com/srv/i?s=MSNSEARCH&r={$link.url}" /></a></td>
<td colspan="2" class="link {$link.status}"{if $link.featured AND $config.featured_highlight AND $config.featured_links} style="background-color: {$config.featured_highlight}"{/if}{if $link.partner AND $config.partner_highlight AND $config.partner_links} style="background-color: {$config.partner_highlight}"{/if}{if $link.sponsored AND $config.sponsored_highlight AND $config.sponsored_links} style="background-color: {$config.sponsored_highlight}"{/if}>

***Replace with the following***

<tr>
<td valign="top" style="padding-right: 10px;"><a href="{$link.url}" class="cat-url">
{if $link.Thumbnail}
<img border="0" width="120" height="94" src="uploads/{$link.Thumbnail}" />
{else}
<img border="0" width="120" height="94" src="http://msnsearch.srv.girafa.com/srv/i?s=MSNSEARCH&r={$link.url}" />
{/if}
</a></td>
<td colspan="2" class="link {$link.status}"{if $link.featured AND $config.featured_highlight AND $config.featured_links} style="background-color: {$config.featured_highlight}"{/if}{if $link.partner AND $config.partner_highlight AND $config.partner_links} style="background-color: {$config.partner_highlight}"{/if}{if $link.sponsored AND $config.sponsored_highlight AND $config.sponsored_links} style="background-color: {$config.sponsored_highlight}"{/if}>

***Save file***

omaron
02-01-2007, 05:31 PM
Thanks alot.

Thumbnail field is actually url, so i need to use src="{$link.Thumbnail}", so i changed it and works perfect.

Dave Baker
02-01-2007, 05:35 PM
You're welcome omaron!
Thumbnail field is actually url, so i need to use src="{$link.Thumbnail}", so i changed it and works perfect.
I didn't know about it. :D

omaron
02-01-2007, 05:47 PM
Yes, my bad.. i should have mentioned. I am sorry to be such a pain in the ass..

I maybe ask too many questions, but is just till i have all set as planned. I either ask or :wallbash:

Dave Baker
02-01-2007, 05:58 PM
omaron please feel free to ask questions :)

omaron
02-17-2007, 11:33 AM
Hi.. unfortunately upgrading to 2.1 brought me some problems.. 90% of my custom template was broken, so i had to start over with a new template.

Switching thumbs is the first issue. I have a custom field where people can submit thumbs ($link.thumbnail), and i am using this code in link-display.tpl (SkyStars template)

<td>
<div class="preview">
<a href="{$link.url}" id="l{$link.id}" target="_blank">
{if $link.thumbnail}
<img border="0" width="120" height="94" src="{$link.thumbnail}" />
{else}
<img width="120" height="94" src="http://msnsearch.srv.girafa.com/srv/i?s=MSNSEARCH&r={$link.url}" alt="" />
{/if}
</a>
</div>
</td>

The problem is that the msn image does not show.. and i have no idea why.. If i change the code and remove the {if} and use always the msn images it works. But if i try to show msn only when own thumbnail not exist, is not working anymore..

Can anyone help ?

Dave Baker
02-17-2007, 04:34 PM
Hello omaron,
Please make sure that you have field with name "thumbnail". You can check it here Admin Panel » Manage Listing Fields

omaron
02-17-2007, 06:28 PM
I do have that field. And the submited image works. What does not show up anymore is the msn image.

If i use only

<td>
<div class="preview">
<a href="{$link.url}" id="l{$link.id}" target="_blank">
<img width="120" height="94" src="http://msnsearch.srv.girafa.com/srv/i?s=MSNSEARCH&r={$link.url}" alt="" />
</a>
</div>
</td>

Is ok, MSN image show, but if i put the IF condition as in the prior post, is not working anymore.. image show only if own thumbnail exist, for rest, instead of image i get No picture default pic.

Dave Baker
02-19-2007, 04:30 PM
Omaron,
Smarty consider "Thumbnail" and "thumbnail" as a different value and if you create field with name "thumbnail" you should use "{$link.thumbnail}" variable in your condition. Please check it too. If it's not the reason of problem please send me PM you ftp/admin panel credentials. I will try to check it.

omaron
02-19-2007, 08:32 PM
I sent you the PM, the field name is correct, i PM you more details.

Thanks.

Dave Baker
02-19-2007, 09:26 PM
Omaron your field "thumbnail" was created with default value "http://".
You condition should looks like this code:

{if $link.thumbnail neq "http://" OR !$link.thumbnail}
<img border="0" width="120" height="94" src="{$link.thumbnail}" />
{else}
<img width="120" height="94" src="http://msnsearch.srv.girafa.com/srv/i?s=MSNSEARCH&r={$link.url}" alt="" />
{/if}

Please check your directory.