Monday 19 May 2008

Dynamic layouts in sitemesh

If you need to add sections into your sitemesh template you can use the <content/> tag.
For example, in main.gsp you might have something like this:

<body>
<div class="nav">
<span class="menuButton"><a href="http://www.blogger.com/" class="home">Home</a></span>
<g:pageproperty name="page.extraNav"/>
</div>
<g:layoutbody/>
</body>

Then you can add extra buttons to the nav bar in your pages by adding:

<content tag="extraNav">
<span class="menuButton"><a href="page/create" class="create">New Page</a></span>
</content>

No comments: