Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Nesting Views
  • Hello, With 1.1 RC1 i noticed that the welcome controller is using
    return Response::forge(View::forge('welcome/index'));
    
    to send a view. Its ok for me to use this on my views so i can include my header and/or footer ?
    echo View::forge('my_header');
    

    I know it works, because i tested it already, since i was using this to have header and footer
      // Carregar a página.
      //
      $view = View::factory('empresa/inicio');
    
      // Carregar os views.
      //
            $view->topo   = View::factory('topo');
            $view->footer = View::factory('footer');
    
            // Mostrar a página.
            //
            $this->response->body = $view;
    

    And now one line of code seems to be enough, its good, i just want to know if it is ok to code this way or not
  • In the example, a view object is passed, forged on the spot. But you can pass anything when you create a response object.
    // Carregar a página.
    // 
    $view = View::factory('empresa/inicio'); 
    
    // Carregar os views. 
    // 
    $view->topo = View::factory('topo'); 
    $view->footer = View::factory('footer'); 
    
    // Mostrar a página. 
    // 
    return Response::forge($view);
    

Howdy, Stranger!

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

In this Discussion