The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

OpenInteract2::Controller::MainTemplate - Controller for content to be placed in a main template

SYNOPSIS

 # In server config
 
 [controller tt-template]
 content_generator = TT
 class             = OpenInteract2::Controller::MainTemplate
 
 # In your action (not done often)
 [myaction]
 controller = tt-template

DESCRIPTION

METHODS

add_content_param( $key, $value )

Adds a parameter to be passed to the main template. This is the template the generated content will be placed into using the key 'content'. Any additional parameters you set here will also be passed to the template.

For example, one key used in OpenInteract2::Template::Plugin is 'title', which is used as the page title (in the <title> tag).

Returns: the value set.

remove_content_param( $key )

Deletes the parameter $key from those passed to the main template.

Returns: previously set value for $key

content_params()

Returns a hashref with all set content parameters.

add_template_param( $key, $value )

Adds a parameter to be passed to the template processing engine. This is not passed to the template itself.

Returns: the value set

remove_template_param( $key )

Deletes the template (not content) parameter by the name of $key.

Returns: previously set value for $key

template_params()

Returns a hashref with all set template parameters

PROPERTIES

Template Properties

The following properties are OPTIONAL. If neither is set the controller will find the main template from the theme of the current user and place the content into it.

main_template - Alternate template into which the content will be placed using the key 'content'.

no_template - Setting this to 'yes' tell the controller to return the generated content rather than place it into a template. This is useful for content destined for popup windows.

You can also specify a GET/POST parameter with this information: if you pass 'no_template=yes' the controller will spot this and make the template change for you. This is useful for popup windows and other nonstandard displays.

If you find yourself doing this consistently rather than in special cases you might also look into setting a different controller for that action. Setting:

 [myaction]
 controller = raw

will tell OpenInteract2 to use the OpenInteract2::Controller::Raw class instead of this one. It just deposits the generated content in the response, no fuss no muss.

main_template_key - This is the key used to find the main template in the theme. It's only used if the main_template property is undefined. If this key isn't defined use use the key 'main_template' by default. (TODO: Sort out template key foo from server config.)

SEE ALSO

OpenInteract2::Controller

COPYRIGHT

Copyright (c) 2002-2004 Chris Winters. All rights reserved.

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

AUTHORS

Chris Winters <chris@cwinters.com>