Template code | Chunk output | |
---|---|---|
<p>The $bones tag is type: {$bones|type}</p> <ul> {.loop in $bones as $bone} <li> {$bone}</li> {/loop} </ul> <hr/> <p>The $shape tag is type: {$shape|type}</p> <ul> {.loop in $shape as $attr:$value} <li> {$attr} - {$value}</li> {/loop} </ul> <hr/> <p>The $name tag is type: {$name|type}</p> <div>Name: {$name}</div> <hr/> <p>The $place tag is type: {$place|type}</p> 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(); |
|
<p>The $bones tag is type: LIST</p> <ul> <li> thigh bone</li> <li> knee bone</li> <li> shin bone</li> </ul> <hr/> <p>The $shape tag is type: OBJECT</p> <ul> <li> form - circle</li> <li> shape - round</li> <li> area - πr²</li> </ul> <hr/> <p>The $name tag is type: STRING</p> <div>Name: Lady Gaga</div> <hr/> <p>The $place tag is type: NULL</p> The $bones tag is type: LIST
The $shape tag is type: OBJECT
The $name tag is type: STRING Name: Lady Gaga
The $place tag is type: NULL |