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:

<div class="nav">
<span class="menuButton"><a href="" class="home">Home</a></span>
<g:pageproperty name="page.extraNav"/>

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>

No comments: