Skip to the content
Documentation

Performance tuning tip

No ratings yet

It is much better to limit the data returned by a fetch function (eg. 'list' or 'tree') than to do a huge fetch and use offset and limit on the subsequent foreach, as is often the case when paginated content is shown. To recover the number of total elements available the fecth functions list_count and tree_count are available.
{def $offset=0
$max=5
$nodes=fetch('content', 'tree', hash(
'parent_node_id', 2,
'offset', $offset,
'limit', $max))}
$nc=fetch('content', 'tree', hash('parent_node_id', 2))}
{foreach $nodes as $mynode=
...