Budgie::HtmlBudgie - a templating engine somewhat similar to HTML::Template
This class implements a templating engine using the Budgie toolkit. It is intended to showcase Budgie's features, and to provide a way to unit-test them. But it can also be used for producing real output.
The tag syntax is modeled after HTML::Template, but there are lots of incompatibilities.
.sub _main @MAIN .local pmc cons # the constructor sub .local pmc tmpl # the template instance load_bytecode 'Budgie.pbc' load_bytecode 'Budgie/HtmlBudgie.pbc'
cons = find_global 'Budgie::HtmlBudgie', 'new_' tmpl = cons()
tmpl.for_string("Hello <tmpl_var a>\n") tmpl.set_param("a", "World") tmpl.print() .end
Just like HTML::Template, HtmlBudgie uses <tmpl_* > tags. They have to be lower case.
See the Budgie::EL manpage for what expressions are supported. In the simplest case, this is just the name of a parameter. Parameter names are case-sensitive.
URL-escapes before outputting.
URL-unescapes before outputting.
You can loop over arrays or integers.
Inside the loop you have access to these special variables
In HTML::Template you can only loop over arrays of hashes. Budgie lets you loop over anything.
Nesting of tags does not always work.
Crashes when encountering an unknown tag.
Thilo Planz
Budgie is Copyright (c) 2005 Thilo Planz. All Rights Reserved.
This code is distributed under the GNU General Public License found in the file LICENSE
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.