NAME
OpenGuides::Template - Do Template Toolkit related stuff for OpenGuides applications.
DESCRIPTION
Does all the Template Toolkit stuff for OpenGuides. Distributed and installed as part of the OpenGuides project, not intended for independent installation. This documentation is probably only useful to OpenGuides developers.
SYNOPSIS
use Config::Tiny;
use OpenGuides::Utils;
use OpenGuides::Template;
my $config = Config::Tiny->read('wiki.conf');
my $wiki = OpenGuides::Utils->make_wiki_object( config => $config );
print OpenGuides::Template->output( wiki => $wiki,
config => $config,
template => "node.tt",
vars => { foo => "bar" }
);
METHODS
- output
-
print OpenGuides::Template->output( wiki => $wiki, config => $config, template => "node.tt", content_type => "text/html", cookies => $cookie, vars => {foo => "bar"} );
Returns everything you need to send to STDOUT, including the Content-Type: header. Croaks unless
template
is supplied.The variables supplied in
vars
are passed through to the template specified. Additional Template Toolkit variables are automatically set and passed through as well, as described below. Note: variables set invars
will over-ride any variables of the same name in the config object or the user cookies.openguides_version
site_name
cgi_url
full_cgi_url
contact_email
stylesheet
home_link
formatting_rules_link
(unlessomit_formatting_link
is set in user cookie)navbar_on_home_page
home_name
If
node
is supplied: - *
node_name
- *
node_param
(the node name escaped for use in URLs)
Content-Type: defaults to text/html
and is omitted if the content_type
arg is explicitly set to the blank string.
- extract_metadata_vars
-
my %node_data = $wiki->retrieve_node( "Home Page" ); my %metadata_vars = OpenGuides::Template->extract_metadata_vars( wiki => $wiki, config => $config, metadata => $node_data{metadata} ); # -- or -- my %metadata_vars = OpenGuides::Template->extract_metadata_vars( wiki => $wiki, config => $config, cgi_obj => $q ); # -- then -- print OpenGuides::Template->output( wiki => $wiki, config => $config, template => "node.tt", vars => { foo => "bar", %metadata_vars } );
Picks out things like categories, locales, phone number etc from EITHER the metadata hash returned by CGI::Wiki OR the query parameters in a CGI object, and packages them nicely for passing to templates or storing in CGI::Wiki datastore. If you supply both
metadata
andcgi_obj
thenmetadata
will take precedence, but don't do that.
AUTHOR
The OpenGuides Project (openguides-dev@openguides.org)
COPYRIGHT
Copyright (C) 2003 The OpenGuides Project. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
3 POD Errors
The following errors were encountered while parsing the POD:
- Around line 91:
Expected text after =item, not a bullet
- Around line 93:
Expected text after =item, not a bullet
- Around line 163:
'=item' outside of any '=over'