Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
how to load view
  • how to load view w/o include template in template.php ?
  • Not sure what you mean, but this should work:
    $this->output = View::factory('home');
    

    or this if you want it to be outputted as a string:
    $this->output = View::factory('home')->render();
    
  • actually i dont want to use template from template.php
    i just want to $this->load->view('index',$data); just like ci. if
    $this->output = View::factory('index',$data);
    
    , i will get
    #3
    ErrorException [ Notice ]: Undefined variable: content
    
    APPPATH/views/template.php
    

    any idea ?
  • Here's a messy-ish way of doing this: 1) Make APPPATH/views/template.php's content like this:
    <?php
    echo $content;
    

    2) Then in your controller, to load a view do this:
    $this->content = View::factory('index',$data);
    

    This'll allow you to load the view kind of like in CodeIgniter. HOWEVER, I'd like to warn you that this is not really how views in FuelPHP where intended to work.
  • i just realize,i use extends Controller_Template,LOL.
    extends Controller works fine.thanks anyway guys.
  • No prob :)

Howdy, Stranger!

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

In this Discussion