Template Toolkit
From Cyclone3 Wiki
(Difference between revisions)
(New page: Template Toolkit is from commit r5950 (2011-09-07) integrated part of Cyclone3 Framework, special TOM::Template library and everyone can use it. == Examples of usage == Perl code <p...) |
(→Examples of usage) |
||
Line 2: | Line 2: | ||
== Examples of usage == | == Examples of usage == | ||
+ | |||
+ | For Template Toolkit grammar check this documentation [http://template-toolkit.org/] | ||
Perl code | Perl code |
Revision as of 13:56, 12 September 2011
Template Toolkit is from commit r5950 (2011-09-07) integrated part of Cyclone3 Framework, special TOM::Template library and everyone can use it.
Examples of usage
For Template Toolkit grammar check this documentation [1]
Perl code
my $tpl=new TOM::Template( 'level' => "auto", 'name' => "test", 'content-type' => "xhtml" ); # fill test data for (1..10) { my %db0_line=( 'name'=>"test string".$_ ); $tpl->variables_push(\%db0_line); } $tpl->process(); print $tpl->{'output'};
XML template (TOM::Template)
<?xml version="1.0" encoding="UTF-8"?> <template> <header> <tt enabled="true" /> </header> <entity id="main"> <![CDATA[ <h1>[%title%]</h1> <ul> [%FOREACH item IN items%] <li>name: [%item.name%]</li> [%END%] </ul> </template>