Text::PORE::Template - PORE Template Handle


        $tpl = new Text::PORE::Template('file'=>'demo.tpl');
        $tpl = new Text::PORE::Template('id'=>'demo');


PORE::Template represents the handle for PORE templates. To instantiate a PORE::Template object, either a filename of the template or the a template id is required. The instance is then passed to PORE::render() during the rendering process.


        new Text::PORE::Template('file'=>$filename);
        new Text::PORE::Template('id'=>$template_id);

A PORE::Template object can be created in two different ways, by accepting a filename or a template id.

To create a template using a filename, the syntax is new Text::PORE::Template('file'=>$filename), where $filename is the full path of a file.

To create a template using a template id, the syntax is new Text::PORE::Template('id'=>$template_id), where $template_id is the id of a template. In this case, templates are stored in a predefined directory called template root. By default, the template root is the current directory. Template root can be changed by calling PORE::setTemplateRootDir(). All template files stored in this directory must be named in the format of <template_id>.tpl, where <template_id> is the id of this template.


Zhengrong Tang,


Copyright 2004 by Zhengrong Tang

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.