7.2.6 Sitemesh Content Blocks 3.0.10

See the light - agile, industrial strength, rapid web application development made easy

(Quick Reference) # 7.2.6 Sitemesh Content Blocks - Reference Documentation Authors: Graeme Rocher, Peter Ledbrook, Marc Palmer, Jeff Brown, Luke Daley, Burt Beckwith, Lari Hotari Version: 3.0.10 ## 7.2.6 Sitemesh Content Blocks Although it is useful to decorate an entire page sometimes you may find the need to decorate independent sections of your site. To do this you can use content blocks. To get started, partition the page to be decorated using the `<content>` tag:

    <content tag="navbar">
    … draw the navbar here…
    </content><content tag="header">
    … draw the header here…
    </content><content tag="footer">
    … draw the footer here…
    </content><content tag="body">
    … draw the body here…
    </content>
Then within the layout you can reference these components and apply individual layouts to each:
    <html>
        <body>
            <div id="header">
                <g:applyLayout name="headerLayout">
                    <g:pageProperty name="page.header" />
                </g:applyLayout>
            </div>
            <div id="nav">
                <g:applyLayout name="navLayout">
                    <g:pageProperty name="page.navbar" />
                </g:applyLayout>
            </div>
            <div id="body">
                <g:applyLayout name="bodyLayout">
                    <g:pageProperty name="page.body" />
                </g:applyLayout>
            </div>
            <div id="footer">
                <g:applyLayout name="footerLayout">
                    <g:pageProperty name="page.footer" />
                </g:applyLayout>
            </div>
        </body>
    </html>
| Quick Reference (hide)