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.

Archive

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

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

Two columns


Reply

3 Posts   1870 Views

Avatar
jkt

30 May 2007 at 11:03pm (Last edited: 30 May 2007 11:03pm), Community Member, 1 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

Avatar
Ingo

31 May 2007 at 5:20pm Forum Moderator, 801 Posts

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

31 May 2007 at 9:47pm (Last edited: 31 May 2007 9:49pm), Forum Moderator, 921 Posts

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