How to create common layout fields

edited February 2014 in News & Announcements
Hi, I have following common fields,

$common_tabs = array( 'css_tab' => array('type'=>'fieldset','label'=>'CSS','class'=>'tab'), 'css' => array('type'=>'textarea','display_label'=>false,'class'=>'no_editor','style'=>'width: 157%;'), 'js_tab' => array('type'=>'fieldset','label'=>'JS','class'=>'tab'), 'js' => array('type'=>'textarea','display_label'=>false,'class'=>'no_editor','style'=>'width: 157%;') );
And I have several layouts. And I'm including all $common_tabs to all of my layouts like following
$_layout_1 = new Fuel_layout('_layout_1'); $_layout_1->set_label('Layout 1'); $_layout_1->add_fields($common_tabs); $config['layouts']['_layout_1'] = $_layout_1;

$_layout_2 = new Fuel_layout('_layout_2'); $_layout_2->set_label('Layout 2'); $_layout_2->add_fields($common_tabs); $config['layouts']['_layout_2'] = $_layout_2;

If I want to access my 'css' and `js` in my `layouts.php`. How can I call It,

Comments

  • edited 5:22AM
    If the CSS and js is specific to a field, you can create a custom field to associate those files with your field, or you can use the "js" and "css" parameters on a field to load in javascript and css files:
    $fields['my_field']['js'] = array('my_js'); $fields['my_field']['css'] = array('my_css');
  • edited 5:22AM
    Its not clear enough, This is not for a particular fields. This is a common layout fields.

    If I'am using object, how can I do this ?
  • edited 5:22AM
    When you say access to your 'css' and 'js' in your layouts, do you mean you want to edit the actual CSS and Javascript in for your layout in the CMS? Or are you simply wanting to include CSS and Javascript in your layout files (e.g. the js or css function)? Or do you mean something else?
Sign In or Register to comment.