Public side Controller and main layout

edited January 2014 in Share
So, I have a CMS created "home" page, can view the page on the public side and can see it uses the "main" layout.

For a different page, I wanted to create a controller and have that page rendered using the same "main" layout.

class Usedb extends CI_Controller { function __construct() { parent::__construct(); } function index() { $this->load->library('session'); $vars = array('page_title' => 'Use Database','layout'=>'main'); $page_init = array('location' => 'usedb'); $this->fuel->pages->render('', $vars, $page_init); } }

The result is a blank page :(

What am I missing?



  • edited 1:53AM
    For the first parameter of the "render" method, try passing it a view location or a page location from the CMS. Also, if you have a page created in the CMS and and view file, you may need to specify the "render_mode" => "cms" OR "render_mode" => "views" parameter for the $page_init.
  • with
    $page_init = array('location'=>'usedb','render_mode'=>'view'); $this->fuel->pages->render('usedb', $vars, $page_init);
    and a test "usedb.php" view, I have had some success - my test view appears with the "main" view's header & footer blocks.
  • edited 1:53AM
    If you have a page in the cms with a location value of "usedb" then you can use 'render_mode' => 'cms' to pull from the cms.
Sign In or Register to comment.