Sunday 20 August 2006 1:14:54 am
Hi Frode,
I have to admit that I am not sure what you mean by old and new template language, but here my idea on how to do this (please node that the code is not tested and may contain some typos): - Have a frontpage (node 2) that displays the 5 latest object from all top-nodes
{* fetch all top nodes that are folders *}
{def $topNodesArr = ('content', 'list', hash('parent_node_id', $node.node_id,
'class_filter_type', 'include',
'class_filter_array', array('folder')))
$subNodesArr = array()}
{* now loop through all these top nodes and fetch the 5 latest objects *}
{foreach $topNodesArr as $topNode}
{set $subNodesArr = ('content', 'list', hash('parent_node_id', $topNode.node_id,
'sort_by', array('published', false()),
'limit', 5))}
{foreach $subNodesArr as $subNode}
{* display the node *}
{node_view_gui view=line content_node=$subNode}
{* or just link to the subnode *}
<a href={$subNode.url_alias|ezurl()}>{$subNode.name}</a><br />
{/foreach}
{/foreach}
You will have to override the default folder template with the the code above and set an override match condition that matches node 2. Please note that this feteches the 5 latest children of the respective node. If you interested in the 5 latest nodes that are somewhere below the respective node, you have to replace the fetch function 'list' by 'tree'.
Now the second part:
- When entering a top-node, the frontpage on each top-node should have it's own frontpage that displays the 5 latest objects from all sub-nodes. The template code is the same as above.
Then you will have to create an override which matches all folders that have 2 as parentnode, so the match conditions should be like this:
Match[class_identifier]=folder Match[parent_node]=2 This way you have both the frontpage (node 2) and the direct subnodes (that are folders) displaying the five latest subnodes, all other folders still use the default template. If the code above is what you consider old template language please give me a link to some information about the new language so I can learn how to do it. Greetings from Luxembourg Claudia
|