man Bric::Util::Burner::TemplateToolkit () - Bric::Util::Burner subclass to publish business assets using TemplateToolkit formatting assets.
NAME
Bric::Util::Burner::TemplateToolkit - Bric::Util::Burner subclass to publish business assets using TemplateToolkit formatting assets.
VERSION
$LastChangedRevision$
DATE
$LastChangedDate: 2005-07-22 17:36:19 -0700 (Fri, 22 Jul 2005) $
SYNOPSIS
use Bric::Util::Burner::TemplateToolkit;
# Create a new TemplateToolkit burner using the settings from $burner $tt_burner = Bric::Util::Burner::TemplateToolkit->new($burner);
# Burn an asset, get back a list of resources @resources = $tt_burner->burn_one($ba, $at, $oc, $cat);
DESCRIPTION
This module handles burning business assets using TemplateToolkit formatting assets.
INTERFACE
Constructors
- $obj = Bric::Util::Burner::TemplateToolkit->new($burner);
- Creates a new TemplateToolkit burner object. Takes a single parameters - CW$burner - which is a Bric::Util::Burner object. The new object will has its attributes initialized by the passed object.
Public Instance Methods
Publishes an asset. Returns a list of resources burned. Parameters are:
- *
- $ba A business asset object to publish.
- *
- $at A asset type object for CW$ba
- *
- $oc An output channel object to use for the publish
- *
-
cat
A category in which to publish.
Compiles the template found in CW$ba. If the compile succeeds with no
errors, chk_syntax() returns true. Otherwise, it returns false, and the error
will be in the CW$err variable passed by reference.
Throws: NONE.
Side Effects: NONE.
Notes: This method has not yet been implemented for Template Toolkit
templates. For the time being, it always returns success.
Finds the first instance of the template with the name CW$tmpl_name in the URI
directory hierarchy in CW$uri. Returns the template path, if it exists, and undef
if it does not. For example:
my $uri = '/foo/bar/bletch'; my $tmpl_name = 'story.mc'; my $template = $burner->find_template($uri, $tmpl_name);
The find_template() method will look first for '/foo/bar/bletch/story.mc', and return that string if the template exists. If it doesn't, it'll look for '/foo/bar/story.mc'. If it doesn't find that, it'll look for '/foo/story.mc' and then '/story.mc'. If it finds none of these, it will rutrn null (or an empty list in an array context. Throws: NONE. Side Effects: NONE. Notes: Uses HTML::Mason::Interp->comp_exists() internally to determine if the template exists. Returns the path to the first template it finds in CW@tmpl_list. It uses find_template() (see above) to examine each template in CW@tmpl_list in turn. Thus, this method looks down the directory hierarchy of each template in CW@tmpl_list before moving on to the next one. For example:my @tmpl_list = ('/foo/bar/story.mc', '/sci/anthro/fizzle.mc'); my $template = $burner->find_first_template(@tmpl_list)
In this example, find_first_template will return the name of the first template it finds in this order: - *
- /foo/bar/story.mc'
- *
- /foo/story.mc'
- *
- /story.mc'
- *
- /sci/anthro/fizzle.mc'
- *
- /sci/fizzle.mc'
- *
-
/fizzle.mc'
If no template is found to exist, find_first_template will return undef (or an
empty list in an array context).
Throws: NONE.
Side Effects: NONE.
Notes: See also find_template() above.
A method to be called from template space. Use this method to display
paginated elements. If this method is used, the burn system will run once for
every page element listed in CW\@paginated_element_names (or just
CW$paginated_element_name) in the story; this is so that autohandlers will be
called when appropriate. All arguments after the first argument will be passed
to the template executed as its CW%ARGS hash.
Throws: NONE.
Side Effects: NONE.
Notes: NONE.
A method to be called from template space. This method will find the mason
element associated with the element passed in and call CW$m->comp. All
arguments after the first argument will be passed to the template executed as
its CW%ARGS hash.
Throws: NONE.
Side Effects: NONE.
Notes: NONE.
% unless ($burner->get_more_pages) { <h3>Last page</h3> % }
Returns true if more pages remain to be burned, and false if not. Only enumerated when CWdisplay_pages() is being used to output pages. Throws: NONE. Side Effects: NONE. Notes: NONE.
PRIVATE
Private Class Methods
NONE.
Private Instance Methods
Adds a Bric::Dist::Resource object to this burn. Throws: NONE. Side Effects: NONE. Notes: NONE. Given an element (a business asset/data tile) return the template element that formats it. Throws: NONE. Side Effects: NONE. Notes: NONE. Return the current element in this context. Throws: NONE. Side Effects: NONE. Notes: NONE. Return the current element type in this context. Throws: NONE. Side Effects: NONE. Notes: NONE. Push and pops an element from the element stack. As a story is burned, the burn process can travel down several elements deep. This stack records the order in which each element was transversed so when the burn process exits an element, the correct and current element is at the top of the stack. Throws: NONE. Side Effects: NONE. Notes: NONE.
Private Functions
None.
NOTES
NONE.
AUTHOR
Garth Webb gtgarth@perijove.comlt
Sam Tregar gtstregar@about-inc.comlt
David Wheeler gtdavid@wheeler.netlt
SEE ALSO
Bric, Bric::Util::Burner