Support Forums

Old 02-10-2009, 01:43 PM   #1
Member
 
Join Date: Aug 2008
Posts: 55
Rep Power: 3
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.0.8
nagrap2 is online now   Reply With Quote
Old 02-10-2009, 02:11 PM   #2
Moderator
 
 
Join Date: Mar 2006
Posts: 3,882
Rep Power: 94
Lhotch is just really niceLhotch is just really nice
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.
(Please note: I am not a 68C employee. I am a customer and volunteer who helps with questions where I can and the forums spam free)

Set your site apart from the competition with one of my modules......
Google Map Module | You Tube Module | Google Calendar Module | Event Calendar Module

68 Classifieds Important Links
Customer Area | Issue Tracker | Knowledge Base | User Manuals
Lhotch is offline   Reply With Quote
Old 02-10-2009, 02:18 PM   #3
Member
 
Join Date: Aug 2008
Posts: 55
Rep Power: 3
nagrap2 is on a distinguished road
Default

Larry,

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

Nagrap2

Developer Version 4.0.8
nagrap2 is online now   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
show feature listings by extra field icex v4 Questions & Support 1 10-09-2008 11:27 AM
Extra field display help CHRD v3.1 Questions & Support 4 11-27-2007 11:05 AM
Enabled extra field and pdf file keeps "falling out" of previous listings sedonagate v3.1 Questions & Support 3 09-21-2006 09:50 PM
Using Image as value for extra field. free2take v3.0 Questions & Support 4 04-27-2006 04:09 PM
Displaying extra field in Search and category listings Bucketman v3.0 Questions & Support 3 04-26-2006 10:48 AM


All times are GMT -4. The time now is 11:45 AM.


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