Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Multi Template
  • Hi everyone,

    we can change the website template at controller which extends controller template. 
    class Controller_Example extends Controller_Template
    {
    public $template = 'template_admin';
    ......
    }

    So could we change the website template at action controller which extends controller template? And how to do that? 

    welfare and Regard .
  • HarroHarro
    Accepted Answer
    The template is just a regular view.

    public function action_something()
    {
        $this->template = \View::forge('template_something');

        ....
    }
  • Thanks you Harro Verton, 1 more question to day ^_^

    Do FuelPHP support to split Template into multipart ?

    For example:  all html tag <head> ...</head> we can store at head.phtml, menu store at menu.phtml, banner store at banner.phtml?   
  • Using native Fuel, there are a few options.

    You can use "nested Views" (see http://docs.fuelphp.com/general/views.html) that works with View objects online. You can also use the Theme class, which works with partials for the different sections of your page. And there are template engines (like for example Smarty) that support inclusion of other page sections.

Howdy, Stranger!

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

In this Discussion