LISE - how to access specific fields or properties manually.
Posted: Wed Feb 15, 2017 2:16 am
Hi all,
I have a problem in that have created a custom detail template and I need specific control of the order of fields etc.
All the templates us a loop structure to load the array of fields. I don't want to use a loop I just want to be able to create a table of the item details.
The one I'm haveing specific trouble with is the "Categories" field. How can I access the categories data for an item without using a for each loop?
I have a working template without the categories info but as it seems to be a special case I can't seem to get it to work.
"categories" is the alias of the Category field for each item in the podcast.
I have a problem in that have created a custom detail template and I need specific control of the order of fields etc.
All the templates us a loop structure to load the array of fields. I don't want to use a loop I just want to be able to create a table of the item details.
The one I'm haveing specific trouble with is the "Categories" field. How can I access the categories data for an item without using a for each loop?
I have a working template without the categories info but as it seems to be a special case I can't seem to get it to work.
"categories" is the alias of the Category field for each item in the podcast.
Code: Select all
<div class="episode-detail">
<h2>{$item->title|cms_escape}</h2>
<p><span class="label">Speaker:</span> {$item->speaker}</p>
<p><span class="label">Date:</span> {$item->episodeDate|cms_date_format} (Service: {$item->categories.value|implode:','})</p>
<p><span class="label">Length:</span> {$item->duration}</p>
<p><span class="label">Summary:</span> <br>{$item->summary}</p>
<audio src="{uploads_url}/podcast/{$item->episodeFilename}" controls>
<p>Your browser does not support the <code>audio</code> element.</p>
</audio>
</div>