logo

MMBase tips

An easy way to nest nodes

tip #3 / Mon 9 Nov 2009 / André / 0 comments

Often you need to display two nodes you imported with parameters - or some other way - in your template but they need to be nested. Here is an easy way how.

The contexts of both nodes would get mixed so a convenient way to this is by assigning an id to one of the nodes and have their field tags refer to it.

<mm:import externid="page" />
<mm:import externid="art" />

<mm:node number="$page" id="page_node">
<mm:node number="$art">
<h1><mm:field name="title" node="page_node" /></h2> <div id="content"> <h2><mm:field name="title" /></h2> <p><mm:field name="intro" /></p> </div>
</mm:node>
</mm:node>

The page node has an id 'page_node' to which the first title refers with the attribute 'node="page_node"'.

Of course the first one with id 'pagenode' could also as well be printed outside the article node, but this was just to illustrate the example.

0 comments

RSS feed

Tweet this article

Most mentioned links:

MMBase documentation
MMBase API
MMBase SVN
Bugtracker
MMBase Taglib reference
The reference for all tags mm