Support Forums

Display Image for Extra Field within Listings

This is a discussion on Display Image for Extra Field within Listings within the Technical Support forums, part of the Technical Support Forums category; Hi, I am trying to display an image if the value of one of my "Extra" fields is equal to ...


Go Back   68 Classifieds Forums > Technical Support Forums > Technical Support

This topic is resolved.

If you have a similar issue that this thread does not address, open a new related support topic.

 
Thread Tools Display Modes
Old 02-10-2009, 01:43 PM   #1
Customer
 
Join Date: Aug 2008
Posts: 80
Rep Power: 11
nagrap2 is on a distinguished road
Default Display Image for Extra Field within Listings

Hi,

I am trying to display an image if the value of one of my "Extra" fields is equal to some value within the viewlistings.php page.

I have looked at the viewlistings.tpl file and see the following code used to display the Extra fields I have created under Admin within the Categories --> Extra Fields option. I know the ID of the field I want, so how could I modify the code below to explicitly say, if ID = 4, then do something:

{* Extra Fields *}
{foreach from=$extrafields item=extras}
<tr>
<td><strong>{$extras.title}:</strong></td>
<td>
{if isset($extras.value)}
{foreach key=key item=item from=$extras.value}
{$item}<br />
{foreachelse}
{$extras.value}
{/foreach}
{/if}
</td>
</tr>
{/foreach}
{* End Extra Fields *}

Thanks in advance !!
__________________
Many Thanks,

Nagrap2

Developer Version 4.1
nagrap2 is offline  
Old 02-10-2009, 02:11 PM   #2
curmudgeon
 
Join Date: Mar 2006
Posts: 5,340
Rep Power: 132
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

Have you looked at the DEBUG console to see the variables passed to the template?

If you look at it you can see the $extrafield variable is a multidimensional array and in te template code above smarty loops over the array and addresses each child element as .something......

$extras.title
$extras.value

Now looking back at the debug console you see that there is a title and value as well as a fID which is the field ID so simply use an {if} to see if $extras.fID equals 4 and if so show your image instead of the fiel value.
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline  
Old 02-10-2009, 02:18 PM   #3
Customer
 
Join Date: Aug 2008
Posts: 80
Rep Power: 11
nagrap2 is on a distinguished road
Default

Larry,

You're a superstar !! Thanks !!
__________________
Many Thanks,

Nagrap2

Developer Version 4.1
nagrap2 is offline  
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
show feature listings by extra field icex Technical Support 1 10-09-2008 11:27 AM


All times are GMT -4. The time now is 03:41 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0