OpenInteract2::Controller::MainTemplate - Controller for content to be placed in a main template
# In server config [controller tt-template] content_generator = TT class = OpenInteract2::Controller::MainTemplate # In your action (not done often) [myaction] controller = tt-template
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.
$key
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.
template_params()
Returns a hashref with all set template parameters
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.)
OpenInteract2::Controller
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.
Chris Winters <chris@cwinters.com>
To install OpenInteract2::URL, copy and paste the appropriate command in to your terminal.
cpanm
cpanm OpenInteract2::URL
CPAN shell
perl -MCPAN -e shell install OpenInteract2::URL
For more information on module installation, please visit the detailed CPAN module installation guide.