Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Two columns

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1827 Views
  • jkt
    Avatar
    Community Member
    1 Post

    Two columns Link to this post

    Hi

    I've just started experimenting with Silverstripe, and so far I'm very pleased with it.
    I just found the need to have two columns in some pages, and would like to be able to edit the "left" and "right" content just as with any regular (single-column) page content.

    What's the best way to do this?

    Thanks in advance
    /Jonas

  • Ingo
    Avatar
    Forum Moderator
    801 Posts

    Re: Two columns Link to this post

    Silverstripe doesn't limit you in this, just put in your content as pleased (e.g. $TagCloud in <div id="Sidebar">, and $Content in <div id="Content">). Use CSS to render those two divs as columns.

    see http://www.positioniseverything.net/articles/pie-maker/pagemaker_form.php
    for a good css-layout-creator.

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: Two columns Link to this post

    You'll want to create new HtmlEditorField(s), which are the same as the standard Content field.

    Page.php

    <?php

    class Page extends SiteTree {

    static $db = array(
    'RightContent' => 'Text'
    );

    function getCMSFields() {
    $fields = parent::getCMSFields();
    $fields->addFieldToTab('Root.Content.Right', new HtmlEditorField('', 'Right Content'));
    return $fields;
    }

    }

    Page.ss

    <div id="RightContent">
    $RightContent
    </div>

    Note that I've added this HtmlEditorField into it's own tab. It's easier to use like this, since it's so large compared to say, a text field.

    Cheers,
    Sean

    1827 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.