default layout loads every time

edited March 2014 in Bug Reports
I don't know if this is a bug or if I'm just not following directions. Here is the content of fuel/application/config/My_fuel_layouts.php
$config['default_layout'] = 'main'; $config['layouts_folder'] = '_layouts'; $config['layouts']['main'] = array( 'fields' => array( 'Header' => array('type' => 'fieldset', 'label' => 'Header', 'class' => 'tab'), 'page_title' => array('label' => lang('layout_field_page_title')), 'meta_description' => array('label' => lang('layout_field_meta_description')), 'meta_keywords' => array('label' => lang('layout_field_meta_keywords')), 'Body' => array('type' => 'fieldset', 'label' => 'Body', 'class' => 'tab'), 'heading' => array('label' => lang('layout_field_heading')), 'body' => array('label' => lang('layout_field_body'), 'type' => 'textarea', 'description' => lang('layout_field_body_description')), 'body_class' => array('label' => lang('layout_field_body_class')), 'color' => array('type' => 'colorpicker'), // the type parameter is not really needed because of the representative value ) ); $config['layouts']['none'] = array( 'label' => 'None', 'fields' => array( 'copy' => array('type' => 'copy', 'label' => lang('layout_field_none_copy')), 'body' => array('type' => 'textarea', 'label' => lang('layout_field_body')), ) );
Here's the content of fuel/application/views/layouts/main.php
<?php $CI->load->view('_blocks/header')?> <div class="row collapse" id="main_inner"> <div class="twelve columns"> <?php echo fuel_var('body', ''); ?> </div> </div> <?php $CI->load->view('_blocks/footer')?>
Here's the content of fuel/application/views/layouts/none.php
<?php $CI->load->view('_blocks/header_empty')?> <div class="row" id="main_inner"> <div class="twelve columns"> <?php echo fuel_var('body', ''); ?> </div> </div> <script> <google script goes here> </script> </body> </html>
Note that in the none.php layout, there is a header block that only contains the beginning html and head and opening body section and there's no footer.

At the top of my view, I'm attempting to load the none.php view like this:<?php $CI =& get_instance(); fuel_set_var( 'layout', 'none' );
The none.php layout isn't loading. Instead I'm getting the main.php layout which contains a footer. What am I doing wrong?

Comments

  • edited 5:41AM
    That should work. Have you tried it with a fresh install?
  • edited 5:41AM
    I just pulled the latest fuel from github and getting the same results. I know what you mean, though, get a fresh install and see if all by itself I get the same thing. Thing is, the view is being rendered into an iframe and seems to somehow be losing the layout var in the process of rendering the page and instead loading the default layout.
  • edited 5:41AM
    Navigating to it outside of the iframe has the same results correct?
  • edited March 2014
    yep, so I guess that blows that theory. It's hidden below the bottom of the iframe but it's there nonetheless. Is there a way I can run a debug for that to see where it's overriding, or never running fuel_set_var?
  • edited 5:41AM
    I would perhaps debug the Fuel_pages class in particular variables_render() method perhaps around line 1012 find out what the $layout variable is.
  • edited 5:41AM
    I echoed it out and it's _layouts/main

    I'm bumfuzzled. On the hunt for the culprit.
  • edited 5:41AM
    On line 977 is where it should be pulling in your view file. That process should execute the fuel_set_var function (since it's in that view file) which would register it as a variable on the load object. Line 981 then pulls all the load registered variables and at that point, it should be set to the new layout of 'none'. Have you by chance tried it with a fresh install to see if there may be something else that's causing the problem?
  • edited 5:41AM
    Any luck with this?
  • edited 5:41AM
    no, in the short term I've just added a conditional to hide the footer based on the presence of specific URL param. I haven't tried with a fresh install yet. Ran out of time working on this but will do that and post back.
Sign In or Register to comment.