|
|
#1 |
|
Member
Join Date: Aug 2008
Posts: 55
Rep Power: 3 ![]() |
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 |
|
|
|
|
|
#2 |
|
Moderator
Join Date: Mar 2006
Posts: 3,882
Rep Power: 94 ![]() ![]() |
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 |
|
|
|
|
|
#3 |
|
Member
Join Date: Aug 2008
Posts: 55
Rep Power: 3 ![]() |
Larry,
You're a superstar !! Thanks !!
__________________
Many Thanks, Nagrap2 Developer Version 4.0.8 |
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
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 |