Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Why can't I switch active template in controller
  • 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";
    }
  • Harro VertonHarro Verton
    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");

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion