| Template code | Chunk output | |
|---|---|---|
{#example_1}
<div>
Earth to {$name}. Come in, {$name}.
</div>
{#}
Theme theme = new Theme("examples");
// Fetch template from this file: themes/examples/hello.chtml
// Inside that file there is a template "snippet" named #example_1
Chunk html = theme.makeChunk("hello#example_1");
html.set("name", "Bob");
html.render( out );
// or, render to a string
String output = html.toString();
|
|
<div> Earth to Bob. Come in, Bob. </div>
Earth to Bob. Come in, Bob.
|