Layout pre_process Issue

edited April 2015 in Modules
Version 1.2.1
Docs: http://docs.getfuelcms.com/general/layouts
"Similarly, you can overwite the Base_layout classes fields() method to return the fields for your layout:"

But i can't found the Base Layout file to extend. can anyone help?

Comments

  • edited 4:16PM
    That's a typo and should be the Fuel_layout.php. Often we'll create a Base_layout class that extends the Fuel_layout and inherit from that which is where that typo came from. I'll make a fix for the 1.3 documentation.
  • edited 4:16PM
    Thanks. I am trying to inherit Fuel_layout

    When i inherit Fuel_layout, my view page become blank. Is anything wrong in the config? The path should be correct.

    [MY_fuel_layouts.php]
    $config['layouts']['main'] = array(
    'file' => $config['layouts_folder'].'/main',
    'label' => 'Main',
    'class' => 'Main_layout',
    'filepath' => 'libraries/_layout',
    'filename' => 'Main_layout.php',


    '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')),
    )
    );


    [Main_Layout.php]
    require_once(FUEL_PATH.'libraries/Fuel_layouts.php');
    class Main_layout extends Fuel_layouts {
    function fields()
    {
    $fields = parent::fields($include);

    return $fields;
    }

    function pre_process($vars)
    {
    return $vars;
    }
    }
  • edited 4:16PM
    If you use the class, you can include your fields array in that method instead of in the configuration. Also, there is an $include variable that doesn't look to be defined:
    $fields = parent::fields($include);
Sign In or Register to comment.