NAME

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.


SYNOPSIS

        .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


TEMPLATE SYNTAX

Just like HTML::Template, HtmlBudgie uses <tmpl_* > tags. They have to be lower case.

<tmpl_var expression>

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.

<tmpl_escape_url expression>

URL-escapes before outputting.

<tmpl_unescape_url expression>

URL-unescapes before outputting.

<tmpl_loop expression> ... </tmpl_loop>

You can loop over arrays or integers.

Inside the loop you have access to these special variables

i
The loop iteration counter, starts at 1.

this
If looping over an array, the content of the array at that position.

In HTML::Template you can only loop over arrays of hashes. Budgie lets you loop over anything.

odd
True on the first, third, fifth ... iteration

even
True on the second, fourth, sixth ... iteration

<tmpl_if expression> ... </tmpl_if>

<tmpl_unless expression> ... </tmpl_unless>

<tmpl_if expression> ... <tmpl_else> ... </tmpl_if>


BUGS

Nesting of tags does not always work.

Crashes when encountering an unknown tag.


AUTHOR

Thilo Planz

thilo@cpan.org


LICENSE

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.