In Frontend side, How to use Home body part?

edited December 2010 in News & Announcements
Hello

At Frontend side, I have default controller test() like below.

<?php class Test extends Controller{ function __construct(){ parent::__construct(); } function index(){ } }

I have "main.php" in _layouts folder which is like below,

<?php $this->load->view('_blocks/header')?> <div id="main_inner"> <?=fuel_var('body', '')?> </div> <div class="clear"></div> <?php $this->load->view('_blocks/footer')?>

my global.php file Inside _variables folder

$CI =& get_instance(); $vars = array(); $vars['layout'] = 'main';


Now in main index page of site. it's coming blank,
For example, here is my frontend URL --> http://www.test.com

When I open this URL it's showing blank white page.. Why it's not loading atleast header? Footer part? I think just middle body should come blank, It should be load at least header & footer blocks?

Or I am going in wrong direction? Please help me out of this solution..

I just want to make fix header, footer for every page.. Just middle body part will change every time.. If there is no content then middle body should remain blank, instead of full page.

Thanks.

Comments

  • edited 5:24AM
    Hello I got the solution for this...

    Thanks..
  • edited 5:24AM
    It sounds like you have a solution but wanted to point out that if you are using a controller, then you will need to render the page by using the Fuel_page library in your controller method like so:
    function index() { //... your code here... $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(); }

    The 0.91 branch on GitHub has a contact controller that does this. Also, depending on whether you want the page to be rendered from the CMS or a view file, you can pass the render_mode attribute like so:
    ... $page_init = array('location' => 'home', 'render_mode' => 'cms"); ...
  • edited 5:24AM
    Yes, I have seen the solution from 0.91 branch "Contact" page only..

    Thanks
Sign In or Register to comment.