Multiple Inline Edit Areas With One Layout

edited March 2011 in Modules
I've been looking for an answer to this. In doing so I found this : http://getfuelcms.com/forums/discussion/comment/824/#Comment_824

Basically I can do this if I create more layouts. It seems to me there should be a way to do this with only one layout. Is there a way to have editable areas for individual pages using one layout?

Comments

  • edited March 2011
    When you create your page in the admin, you select which layout you want to use. The layout determines what the editable fields are. The layout variable "body" is used by default to contain whatever your layout calls for. You can add other layout variables in your MY_fuel_layouts.php file to represent other pieces of the page (e.g. a big picture etc). Make sense?
  • edited 3:42PM
    Yeah, that makes sense.

    The thing is, my goal was to not have to deal with users forgetting to close html tags. So I figured I could get more detailed with what they were able to edit. Which would be paragraph text and titles.

    Almost all my pages could use the same layout (header,footer) but they don't all have the same body section. So I thought maybe I could use the same layout, dynamically tell the layout what body to load but have different fuel_vars.

    At the moment, I'm just duplicating the same layout for all my pages. Unless there's a better way. Keep in mind, I'm a new to fuel cms :) Love it so far.
  • edited 3:42PM
    I guess I'd have to see your layout/pages to fully understand. The layout determines the editable variables you can have on your page. However, remember, your layouts are PHP code so you can do some pretty dynamic stuff with that. For example, sometimes we'll create a base layout that contains the core layout information with variables like $h1, $bigpic, $body, $body_class, $blocks etc. Then for different sections of the site, we'll create layouts that essentially "inherit" from that base layout. To do that, we'd do something like:
    // in the views/_layouts/about for the about section of the site $CI=&get_instance(); $vars['h1'] = 'About'; $vars['big_pic'] = 'my_big_pic.jpg'; $vars['blocks'] = array('sidenav', 'testimonials'); $CI->load->view('_layouts/base_layout', $vars);
  • edited 3:42PM
    Thanks to your replay.

    I think that's where I was confused. "The layout determines the editable variables" I was hoping that it only helped in the layout of the page and that you could somehow do something like this in the MY_fuel_layouts.php:

    $config['layout_fields']['layout']['page1'] = array( ...

    then

    $config['layout_fields']['layout']['page2'] = array( ...

    Both page1 and page2 would share the same layout. This isn't possible correct?
Sign In or Register to comment.