Template.pm


NAME

Communiware::Template - implements compilier of templates


SYNOPSIS

        $tpl = new Communiware::Template($attrs,$text)
        $code = $tpl->compile;
        @used_templates = $tpl->used_templates
        @used_filters = $tpl->used_filters


DESCRIPTION

TBD


METHODS

new

        $tpl=Communiware::Templates->new($attrs,$text);

Constructs new template object from hash of attributes and text


compile

        $code = $tpl->compile;
  $code = $tpl->compile($tpl_type);

Compilies template and return perl code which would produce two anonymous subs first to execute template and second to return list of used attrs. Optional second parameter is the type of compiled template - PAGE, ELEMENT, CONTAINER etc. If is is defined and equal CONTAINER then ``my $content=shift;'' line added to compiled code prolog.

uses_filter

        $tpl->uses_filter

Marks filter as used.

Filter should be cleaned up name as returned by Communiware::Unifilters::validate_filter.

uses_template

        $tpl->uses_template

Marks named template as used. Template name should be just name or *virtual_page_name.

used_filters

        @filter=$tpl->used_filters

Returns list of used filters.

used_templates

        @filter=$tpl->used_templates

Returns list of used templates.

instruction

  ($de,$param,$line,$char)=$tpl->instruction($position)

Return dynamic element at given position in template. First arg returned is name of DE, then reference to list of parameters, then line number in template and position in line where it starts.

16 октябрь 2007 13:45