velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jeich...@optonline.net
Subject Tiles put scope?
Date Mon, 12 Jan 2004 07:34:03 GMT

I am beginning to convert a site to using Tiles, and I seem to be having a little problem
understanding scope of variables defined within a Tile.

Basically I have a set of Tiles definitions (defined below) and Master Template defined towards
the bottom.   The default template works except that my web page is created minus two minor
problems.   The topScript (aka javascript) and topTitle seem to not being included within
the sub-template defaultTop.vm.

How can a sub-template see the definitions.   I figured that since the variable was defined
in defaultTemplate that defaultTop would be able to see it.  If not, then how can I pull out
aspects of code like those pieces and not break with Tiles requirements.

I hope this makes sense.

John




Tiles Defs follow:
----------------------

    <definition name="defaultTemplate" path="/WEB-INF/templates/pub/common/tiles/defaultTemplate.vm">
        <put name="topTitle" value="Site Services" />
        <put name="topScript" value="" />
        <put name="top" value="/WEB-INF/templates/pub/common/tiles/defaultTop.vm" />
        <put name="header" value="/WEB-INF/templates/pub/common/tiles/defaultHeader.vm"
/>
        <put name="body" value="/WEB-INF/templates/pub/common/tiles/defaultBody.vm" />
        <put name="footer" value="/WEB-INF/templates/pub/common/tiles/defaultFooter.vm"
/>
    </definition>


    <definition name="tile.welcome" extends="defaultTemplate">
        <put name="body" value="/WEB-INF/templates/pub/home/welcome.vm" />
    </definition>



    <definition name="tile.post.search" extends="defaultTemplate">
        <put name="body" value="/WEB-INF/templates/pub/services/post/search/postsearch.vm"
/>
        <put name="topScript" value="/WEB-INF/templates/pub/common/tiles/defaultFormJavascript.vm"
/>
    </definition>

    <definition name="tile.post.search.results" extends="defaultTemplate">
        <put name="body" value="/WEB-INF/templates/pub/services/post/search/postsearchresults.vm"
/>
    </definition>





I had defined a simple master template as follows:
-----------------------------------------------------------------------

<html>
<head>
    $!tiles.top    
</head>
<body>
<table>
<tr><td valign="top" align="left">
    $!tiles.header   
</td></tr>
<tr><td valign="top"  align="left">
    $!tiles.body    
</td></tr>
<tr><td valign="top" align="left">
    $!tiles.footer   
</td></tr>
</table>
</body>
</html>


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message