Page 1 of 1

LISE - how to access specific fields or properties manually.

Posted: Wed Feb 15, 2017 2:16 am
by d4creative
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.

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>

Re: LISE - how to access specific fields or properties manua

Posted: Wed Feb 15, 2017 6:26 am
by d4creative
I finally resolved this with some experimentation and trying to decipher how the nested array works for the Categories. I hope this helps somebody else.

In my scenarioe it looks like this:
{LISELoader item='category' force_array=1 value=$item->categories assign='cats'}
<td class="podcastService">{$cats|implode:','}</td>

Code: Select all

   {foreach from=$items item=item}
      <!-- item -->
      <tr class="item">
         <td class="podcastDate">{$item->episodeDate|cms_date_format}</td>
         <td class="podcastTitle">{$item->title}</td>
         <td class="podcastSpeaker">{$item->speaker}</td>
         {LISELoader item='category' force_array=1 value=$item->categories assign='cats'}
         <td class="podcastService">{$cats|implode:','}</td>
         <td class="podcastDuration">{$item->duration}</td>
         <td class="playbtn podcastDetail"><a href="{$item->url}">&#x25BA</a></td>
      </tr>
      <!-- item //-->
   {/foreach}