load layout in controller

edited July 2013 in Share
FUEL 0.93

I'm having trouble getting the correct layout to load. This works fine in another website that I've created.

# I have a "main" layout for normal pages and a layout named "home" for the home page..

# I've also created a controller called home and I created a page in the CMS called "Home"..

# my default controller is set to Home...

Home Controller {

$vars = array();

$page_init = array('location' => 'Home');
$this->load->module_library(FUEL_FOLDER, 'fuel_page', $page_init);
$this->fuel_page->add_variables($vars);
$this->fuel_page->render();


problem is.. it loads the "main" layout.. even in the CMS it's set to the "Home" layout.. is there a way to pass the layout through the controller?

I tried:
$page_init = array('location' => 'Home', 'layout' => 'home');

Comments

  • edited 3:49AM
    Add 'render_mode' => 'cms' like so:
    $page_init = array('location' => 'Home','render_mode' => 'cms');
  • edited 3:49AM
    Hmmm.. that didn't work... the thing is.. it loads the body of the correct page.. but no matter what layout I set it on in the CMS it will not load the correct layout.. I can set it to none and it will still load the main layout.
  • edited 3:49AM
    Have you set the render_mode parameter in MY_fuel.php to "auto"?
  • edited 3:49AM
    Yes, I got it to work. For some reason I had to make the location in the controller to "homepage" then create layouts and variables called "homepage"... some how it clicked over and started working..
  • edited 3:49AM
    Perhaps it had something to do with the default_controller route.
Sign In or Register to comment.