Forum
Counting Repeater Items
Hello,
I have a template that uses a simple repeater to add files for download to a region.
<h3><perch:content id="resSection" type="true" label="Resource Type" /></h3>
<perch:repeater id="resourcelib" label="Resources" scope-parent="true">
<a href="<perch:content id="resFile" type="file" label="File" bucket="class-documents" />">
<perch:content id="resTitle" type="text" label="Title" title="true" />
</a>
</perch:repeater>
I want to display only the 3 most recent resources and use a link to display all of the resources. Something like:
if(perch_get('r') == 'resources') {
perch_content_custom('Resources', array(
'template' => '_resources.html',
'sort-order' => 'DESC'
));
} else {
perch_content_custom('Resources', array(
'template' => '_resources.html',
'count' => 3,
'sort-order' => 'DESC'
));
}
Is there a way to count repeater items using perch_content_custom
?
Thanks, Joshua
You can do this in the template.
Thanks Drew, exactly what I needed and it works perfectly.