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.

General Questions /

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

Multiple column content areas


Reply


4 Posts   2022 Views

Avatar
redactuk

Community Member, 117 Posts

30 September 2009 at 11:31am

Edited: 30/09/2009 11:33am

I've been using SS for a month now and I'm getting the hang of it. On one site I've just finished I've created a sidebar for lower level pages to effectively create two columns, but with that in the Admin area I had 'Content' editor then editor below it for 'Sidebar'.

Question: I want a home page with 3 columns. I can see how to create 3 new columns but what do I do with existing 'Content' section? Can I someone remove that from a custom HomePage or do I HAVE to use existing area as one of my 3 columns and change caption in Admin area from 'Content' to say 'Column 1' ?

Avatar
b0bro

Community Member, 38 Posts

30 September 2009 at 12:08pm

Hi dude, have a look at this http://doc.silverstripe.org/doku.php?id=getcmsfields&s=remove%20field

Avatar
redactuk

Community Member, 117 Posts

30 September 2009 at 12:26pm

Edited: 30/09/2009 12:27pm

Excellent, thank you!

but just to be clear, if I add

// remove the content text area
$fields->removeFieldFromTab("Root.Content.Main","Content");

Within my HomePage.php (that extends Page), I'm just removing the visibility of Content within context of the Home page Not from all other page types?

Avatar
b0bro

Community Member, 38 Posts

30 September 2009 at 8:27pm

Edited: 30/09/2009 8:28pm

Yes thats right,

It goes both ways, for example if you use, on page.php

$fields->addFieldToTab("Root.Content", new TextField("ExtraContent", "Extra Content"));

it would appear on everypage that extends page. For example the following page would have ExtraContent

class ExamplePage extends Page {
function getCMSFields() {
    $fields = parent::getCMSFields(); //This is the magic
    return $fields;
   }
}