| Template code | Chunk output | |
|---|---|---|
{!-- Tags that are not defined will pass through into
-- the final output, by design. That way, processed
-- output can be passed as a value into another Chunk
-- that *does* have the necessary tag data.
--
-- Also, tag preservation helps during development to
-- see what parts of the template/code contract have
-- not yet been met.
--}
<html>
<head>
<title>{$title}</title>
</head>
<body class="{$body_class}">
{$body}
</body>
</html>
Theme theme = new Theme();
// fetch template from themes/example.chtml
Chunk html = theme.makeChunk("example");
// Insert business logic here.
// Normally you write a lot of html.set("this","that") calls here.
StreamWriter out = getStreamWriter();
html.render( out );
///// or, return the rendered template as a string
// return html.toString();
|
|
<html>
<head>
<title>{$title}</title>
</head>
<body class="{$body_class}">
{$body}
</body>
</html>
|
| Template code | Chunk output | |
|---|---|---|
{!-- When you don't need tag preservation, just add an empty
-- default to your tags.
--
-- {$tag} will pass through when undefined.
-- {$tag:N/A} will print N/A when undefined.
-- {$tag:} will disappear when undefined.
--}
<html>
<head>
<title>{$title:}</title>
</head>
<body class="{$body_class:}">
{$body:}
</body>
</html>
Theme theme = new Theme();
// fetch template from themes/example.chtml
Chunk html = theme.makeChunk("example");
// Insert business logic here.
// Normally you write a lot of html.set("this","that") calls here.
StreamWriter out = getStreamWriter();
html.render( out );
///// or, return the rendered template as a string
// return html.toString();
|
|
<html> <head> <title></title> </head> <body class=""> </body> </html> |