Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Catalyst::View::TT::CoUserlContributed PCatalyst::View::TT::ControllerLocal(3)

NAME
       Catalyst::View::TT::ControllerLocal - Catalyst TT View with template
       names relative to the Controller

SYNOPSIS
   Use the helper to create a View class for your
	   script/myapp_create.pl view TT TTControllerLocal

       This creates the	MyApp::View::TT	class.

   Forward to the View like you	normally would
	   #Meanwhile, maybe in	a private end action
	   if(!$c->res->body) {
	       if($c->stash->{template}) {
		   $c->forward('MyApp::View::TT');
	       } else {
		   die("No output method!\n");
	       }
	   }

DESCRIPTION
       Catalyst::View::TT::ControllerLocal is like a normal Catalyst TT	View,
       but with	template file names relative to	the current Controller.	So
       with a set of templates like:

	./root/edit.html
	./root/add.html
	./root/Frobniz/add.html

       and an action "add" in the Controller "MyApp::Controller::Frobniz", you
       set "$c->stash->{template}" to "add.html" in order for it to pick up
       the "./root/frobbiz/add.html" template.

       Setting the "$c->stash->{template}" from	Controller
       "MyApp::Controller::Bogon" would	instead	pick the default template in
       "./root/add.html" (since	there is no Bogon subdirectory under root).

       In addition, since there	is no file "edit.html" except in the Frobniz
       directory, C::V::TT::ControllerLocal will default to looking for
       "edit.html" in ./root/ and ./root/base (or whatever you set
       MyApp->config->{INCLUDE_PATH} to).

METHODS
   new
       The constructor for the TT view.	Sets up	the template provider, and
       reads the application config.

   process
       Render the template specified in	"$c->stash->{template}"	or
       "$c->request->match".

       The template file name is fetched from one of the Template's
       include_paths. The name of the current action's namespace is prepended
       to this list, so	for the	action "edit" in "MyApp::Controller::Frobniz",
       the prepended directory is "./root/frobniz".

       Example:	If "$c->stash->{template}" = "edit.html" you can put a
       specific	template in ./root/myaction/edit.html, or a general template
       in ./root/base/edit.html	or ./root/edit.html.

       If the action is	MyApp::Controller::MyAction, the specific template is
       used. If	the action is MyApp::Controller::MyOtherAction,	the
       ./root/base/edit.html is	used.

       See also: Catalyst::View::TT::process.

AUTHOR
       Johan Lindstrom <johanl AT cpan.org>

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

POD ERRORS
       Hey! The	above document had some	coding errors, which are explained
       below:

       Around line 146:
	   Non-ASCII character seen before =encoding in	'AT'. Assuming CP1252

perl v5.24.1			  2005-1Catalyst::View::TT::ControllerLocal(3)

NAME | SYNOPSIS | DESCRIPTION | METHODS | AUTHOR | LICENSE | POD ERRORS

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Catalyst::View::TT::ControllerLocal&sektion=3&manpath=FreeBSD+12.1-RELEASE+and+Ports>

home | help