Hello
I am creating a bloc where I want to show 1 result BUT I want it to change every...10s I don't know.
I have my block and a understood how to filter my record using the ID.= :
{if !empty( $records ) }}
<h3 class='ipsWidget_title ipsType_reset'>{$title}</h3>
{{$Count = 0;}}
{{if $orientation == 'vertical'}}
<div class='ipsPad_half ipsWidget_inner'>
<ul class='ipsDataList ipsContained_container'>
{{foreach $records as $record}}
{$record->_id}
{{if $record->_id === 29}}
<li class='ipsDataItem'>
<div class='ipsType_break ipsContained'>
<a href="{$record->url()->setQueryString( 'do', 'getLastComment' )}" title='{lang="view_this_cmsrecord" sprintf="\IPS\Member::loggedIn()->language()->addToStack( 'content_db_lang_sl_' . $record::$customDatabaseId, FALSE ), $record->_title"}' class='ipsDataItem_title'>{$record->_title}</a>
</div>
<div class='ipsType_break ipsContained'>
<a href="{$record->url()->setQueryString( 'do', 'getLastComment' )}" title='{lang="view_this_cmsrecord" sprintf="\IPS\Member::loggedIn()->language()->addToStack( 'content_db_lang_sl_' . $record::$customDatabaseId, FALSE ), $record->_title"}' class='ipsDataItem_title'>{$record->customFieldDisplayByKey('lien-image-pour-forum')|raw}</a>
</div>
</li>
{{endif}}
{{endforeach}}
</ul>
</div>
{{endif}}
The first thing I would like to know is :
- how to know the number of item in "$records" ? In another way than doing :
{{$Count = 0;}}
{{foreach $records as $record}}
{{$Count = $Count+1;}}
{{endforeach}}
Then ; is their any way of accessing a specific result ? Like the third item ?
last question : do you know any random function ? or do we have to use the rand(x,y) function from HTML ?
Thanks a lot for your help !