![]() |
![]() |
![]() |
|
|
|
|
#1 |
|
Join Date: May 2006
Posts: 15
![]() |
Ich möchte gerne im view-listing.tpl ein Listing-Field einzelnd ansprechen. Im regulären Template läuft das ja über die Passage
################################################## ####### {foreach from=$fields item=field} {if ($field.name neq 'url') && ($field.name neq 'description') && ($field.name neq 'title')} {assign var="key" value=$field.name} <tr> {assign var="field_name" value='field_'|cat:$field.name} <td style="width: 20%;"><strong>{$lang.$field_name}:</strong></td> <td> {if $listing.$key || ($listing.$key eq '0')} {if ($field.type eq 'text') || ($field.type eq 'textarea') || ($field.type eq 'number')} {if $config.html_tags} {$listing.$key|replace:"\r\n":"<br />"} {else} {$listing.$key|escape:"html"} {/if} {elseif $field.type eq 'checkbox'} {arrayToLang values=$listing.$key name=$field.name} {elseif $field.type eq 'storage'} <a href="{$config.base}{$config.dir}uploads/{$listing.$key}">{$lang.download}</a> {elseif $field.type eq 'image'} <img src="{$config.base}{$config.dir}uploads/{$listing.$key}" {* width="{$field.image_width}" height="{$field.image_height}"*} /> {elseif $field.type eq 'combo'} {assign var="field_combo" value="field_"|cat:$field.name|cat:'_'|cat:$listin g.$key} {$lang.$field_combo} {elseif $field.type eq 'radio'} {assign var="field_radio" value="field_"|cat:$field.name|cat:'_'|cat:$listin g.$key} {$lang.$field_radio} {/if} {else} {$lang.not_available} {/if} </td> </tr> {/if} {/foreach} ################################################## ####### mit diesem Code habe ich aber wenig Möglichkeiten, die einzelnen Inhalte zu ordnen und anders darzustellen. Bei einfachen Textfeldern ist das alles kein Problem und wird so gelöst: {if $listing.NAME}{$listing.NAME}{/if} Was tue ich aber bei sog. Combofields, welche mehrer Inhalte über ID's haben: Bei mir gibt es z.B. das Feld Kreditkraten ($listing.creditcards), darunter gibt es dann 0 = VISA 1 = AMEX 2 = Mastercard 3 = EC Wenn ich bei einem solchen Feld {if $listing.creditcards}{$listing.creditcards}{/if} im Template benutze, dann wird folgendes ausgegeben: 0,1,2,3 Ich möchte jetzt das für jeden Eintrag folgendes auf der Listingseite erscheint: <li>VISA</li> <li>AMEX</li> Es muss auch etwas mit "foreach" zu tun haben, aber ich bekomme es nicht hin. Weiss einer Rat oder kann mein Problem mal ins englische Forum reinstellen (mein englisch ist eher poor). Danke, Thanks Jorge |
|
|
|
|
|
#2 | |
|
Join Date: Nov 2006
Posts: 46
![]() |
Think I understand what you are trying to do.
Something I was working on might help. Quote:
|
|
|
|
|
|
|
#3 |
|
Join Date: May 2006
Posts: 15
![]() |
Thanks clickme4, I use this solution at the moment, but there must be an easier way.
|
|
|
|
|
|
#4 |
|
Join Date: May 2006
Posts: 15
![]() |
If you have more than 10 elements or using numbers like 24h in the element description you will have a problem by using replace.
|
|
|
|
![]() |
| Tags |
| listing display, listing fields, single line |
| Thread Tools | |
| Display Modes | |
|
|