Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

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

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

Two columns


Go to End


3 Posts   2167 Views

Avatar
jkt

Community Member, 1 Post

30 May 2007 at 11:03pm

Edited: 30/05/2007 11:03pm

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

Avatar
Ingo

Forum Moderator, 801 Posts

31 May 2007 at 5:20pm

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.

Avatar
Sean

Forum Moderator, 922 Posts

31 May 2007 at 9:47pm

Edited: 31/05/2007 9:49pm

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