Jump to:

22976 Posts in 11702 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » Create multiple column layouts in backend

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 598 Views
  • danzzz
    Avatar
    Community Member
    175 Posts

    Create multiple column layouts in backend Link to this post

    hi,

    there are some old forum posts about this thema ... but I want to ask you again, may some of you have new innovative solutions or may know a module to do this:

    Whats the best way to give a user the possibility to create multiple columns in backend?
    For example I want a layout with a 100% col, then 3 cols, then 2 cols, then again a 100% col. In each col I want to insert just HMTL content (HTMLText).

    And I dont mean just to give him some page types with different layouts, thats not very flexible ...

    happy ss'ing

  • kinglozzer
    Avatar
    Community Member
    138 Posts

    Re: Create multiple column layouts in backend Link to this post

    I'm not entirely sure what you mean by "100% col, then 3 cols, then 2 cols, then again a 100% col." - as in 100% at the top, 3 underneath, 2 under that and then 100% at the bottom?

    Could you not achieve this by adding extra HTMLEditor fields or TextArea fields for each of the columns? Then styling them in your template - you could use a set of 'if' statements to achieve different layouts based on which columns are filled in.

    Unless someone has a better idea?

  • danzzz
    Avatar
    Community Member
    175 Posts

    Re: Create multiple column layouts in backend Link to this post

    hi

    "as in 100% at the top, 3 underneath, 2 under that and then 100% at the bottom?" => YES I mean like that

    The user should can create multiple column layouts without using page types. All the needed HTML code should stored
    just in $Content field ... so it's more a JS thing I think ...

  • novaweb
    Avatar
    Community Member
    109 Posts

    Re: Create multiple column layouts in backend Link to this post

    To achieve this in the past, I have created one page type for each of the different required layouts, then coded CSS accordingly

    ie)

    TwoColumnPage.php
    ThreeColumnPage.php

    Then the user just selects which layout they desire by picking the corresponding page type.

    Multiple Content Areas may be necessary as pointed out by kinglozzer

    Cheers,
    Josh

  • nimesodelta
    Avatar
    Community Member
    18 Posts

    Re: Create multiple column layouts in backend Link to this post

    I use CSS3 for doing this now.

    http://www.w3schools.com/css3/css3_multiple_columns.asp

    Or I just create new HTMLEditorField for each column.

    You could create a has_many rule to a object like

    <?php
    class Column extends DataObject {

       static $db = array(
          "Content" => "HTMLText",
       );

       public static $has_one = array(
          "Page" => "Page"
       );
    }

    And then use a complexTableField to create as many columns as you want for each page... maybe. You will need to create some funky Template loops and also clever CSS or javascript to float and set widths of each column.

    Hope this helps

    598 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.