Love Fuel?
Donate
About
Forums
Discussions
Login
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Tips and Tutorials
Why can't I switch active template in controller
rodas007
March 2015
class Controller_User_Auth extends \Controller_Base_Template
{
// This works
public $template = "default_template";
public function before()
{
parent::before();
// This does not work
$this->template = "cool_new_template";
}
WanWizard
March 2015
Accepted Answer
Because $template should be a View instance.
It is the before() method of the Template controller that converts it if a string (= view name) is given instead of a View.
// this would work
$this->template = \View::forge("cool_new_template");
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,090
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
262
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
WanWizard
March 2015
To Top