Home node for shiru

Put whatever you like here.

NAME

Bugzilla::Template - Wrapper around the Template Toolkit Template object

SYNOPSIS

  my $template = Bugzilla::Template->create;

  my $format = $template->get_format("foo/bar",

                                     scalar($cgi->param('format')),

                                     scalar($cgi->param('ctype')));

DESCRIPTION

This is basically a wrapper so that the correct arguments get passed into

the Template constructor.

It should not be used directly by scripts or modules - instead, use

Bugzilla->instance->template to get an already created module.

SUBROUTINES

precompile_templates($output)

Description: Compiles all of Bugzilla's templates in every language.

             Used mostly by F<checksetup.pl>.

Params: $output - true if you want the function to print

               out information about what it's doing.

Returns: nothing

METHODS

get_format($file, $format, $ctype)
 Description: Construct a format object from URL parameters.



 Params:      $file   - Name of the template to display.

              $format - When the template exists under several formats

                        (e.g. table or graph), specify the one to choose.

              $ctype  - Content type, see Bugzilla::Constants::contenttypes.



 Returns:     A format object.

SEE ALSO

Bugzilla, Template

MojoMojo::Formatter

# Returns the path to the templates based on the Accept-Language

# settings of the user and of the available languages

# If no Accept-Language is present it uses the defined default

# Templates may also be found in the extensions/ tree

sub getTemplateIncludePath {

    my $cache = Bugzilla->request_cache;

    my $lang  = $cache->{'language'} || '';

    $cache->{"template_include_path_$lang"} ||= template_include_path({

        use_languages => Bugzilla->languages,

        only_language => $lang });

    return $cache->{"template_include_path_$lang"};

}