Forums / General / How to automatically display the first item of a folder?
Aymeric Palsky
Thursday 25 August 2011 7:28:53 am
Hi,
As it is written in the title, I would like to know how to automatically display the first item of a folder?
If someone have an idea this will help me, thanks.
kracker
Thursday 30 November 2023 3:24:38 am
Hello,
What you want is possible via a simple template fetch call made within your own custom template.
See the fetch 'limit' parameter, you can set it to 1 and only fetch the first item of your folder node.
See the docs first!
Here is an untested example:
{def $first_item=fetch( 'content', 'list', hash( 'parent_node_id', $indexpage, 'limit', 1, 'sort_by', array( 'published', false() ) ) ) <h1>{$first_item.name|wash}</h1>
Cheers,//kracker
Theme: Lil Xan - (Don't) Watch Me Fall ...
Source: https://www.youtube.com/watch?v=l7lYWlzuHB8
Member since: 2001.07.13 || http://ezpedia.se7enx.com/