2011-12-10 41 views
1

我使用闭包模板,我无法弄清楚如何使用常见的东西(如徽标)和当我呈现其他模板时,他们将被呈现在主要模板之内。我想为每个模板都有一个servlet。在闭包模板中使用主布局模板

回答

3

你可能会是这样的:

从其他模板中调用主模板。在其他模板中,您可以为主模板定义参数。

例如:

{namespace com.example} 

/** 
* Says hello to a person (or to the world if no person is given). 
* @param title the page title 
* @param body the page body 
*/ 
{template .base} 
<html> 
<head> 
<title>{$title}</title> 
</head> 
<body> 
{$body} 
</body> 
</html> 
{/template} 

/** 
* Search Result 
*/ 
{template .servlet1} 
    {call base} 
    {param title} 
     Example Title 
    {/param} 
    {param body} 
     Here comes my body! 
    {/param} 
    {/call} 
{/template} 

当然,如果你想拥有一个灵活而全面的html页面你最终得到了很多的参数。但是这应该引导你。