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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

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

Multi Column layouts


Go to End


21 Posts   11398 Views

Avatar
ajshort

Community Member, 244 Posts

23 January 2009 at 8:36pm

Your getCMSFields() method needs to be INSIDE your Page class - not outside the braces as you currently have it

Avatar
Carbon Crayon

Community Member, 598 Posts

23 January 2009 at 10:40pm

jfusco - This tread expalins how to seperate a dynamic list into two colums: http://www.silverstripe.org/data-model-questions/show/252268

DudhaSource- As ajshort said you need to keep you getCMSFields() function inside the {} of your Page class as this function is part of the 'model' (i.e. your Page class) which makes up your page. I would recommend going through the turorials to get an idea of how it all works. Also make sure your file is called Page.php not Page.css.

Avatar
BuddhaSource

Community Member, 57 Posts

24 January 2009 at 1:54am

Thanks guys,

After some intense work I was finally able to get things to work. But still I m not sure why it din't work before and yes I did consider getCMSFields() function inside the {} . I reinstalled everything from scratch and copied my code and it worked.

I am still referring back to tutorials to get hang of it.

:)

Avatar
Antti

Community Member, 6 Posts

20 October 2009 at 5:35am

Hi!
Im very noob with silverstripe and currently trying to learn it. Could someone please help me

Realy cant understand why this dosnt work for me. Im getting Database error from sapphire\core\model\MySQLDatabase.php line 401. Table 'ss_firstsite.page' doesn't exist. And it dosnt exist.

This comes after ?flush=1

Here is mysite/code/Page.php

class Page extends SiteTree {

public static $db = array(
'ColumnOne' => 'HTMLText',
'ColumnTwo' => 'HTMLText'
);

public static $has_one = array(
);

function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.ColumnOne", new HTMLEditorField('ColumnOne','Column One Content'));
$fields->addFieldToTab("Root.Content.ColumnTwo", new HTMLEditorField('ColumnTwo','Column Two Content'));
return $fields;
}
}

Avatar
Willr

Forum Moderator, 5523 Posts

20 October 2009 at 9:07am

Antti - have you rebuilt the database by going to yoursite.com/dev/build?

Avatar
Antti

Community Member, 6 Posts

30 October 2009 at 4:09am

Thank you willr.

Dont know how i missed that. I realy should consentrate more while reading...

Avatar
robskinn

Community Member, 12 Posts

1 November 2014 at 7:54am

Edited: 01/11/2014 8:12am

Hi,
I'm trying to get the CMS columns working as per this thread but I keep getting errors.

The code I have in my page php file is

class Page extends SiteTree {

	private static $db = array(
        'ColumnOne' => 'HTMLText', 
        'ColumnTwo' => 'HTMLText' 
	);

	private static $has_one = array(
	);

     function getCMSFields() { 
        $fields = parent::getCMSFields(); 
        $fields->addFieldToTab("Root.Content.ColumnOne", new HTMLEditorField('ColumnOne','Column One Content')); 
        $fields->addFieldToTab("Root.Content.ColumnTwo", new HTMLEditorField('ColumnTwo','Column Two Content')); 
        return $fields; 
   } 
}

I noticed that originally in this thread the arrays were set to pubic but that gave an error so I made them private which allowed me to 'build?flush=1'

The only code I have in my page.ss file is;

<% include SideBar %>

<div class="content-container unit size3of4 lastUnit">
	<article>
		<h1>$Title</h1>
		<div class="content">$Content</div>
	</article>
		$Form
		$PageComments

               $ColumnOne
               $ColumnTwo        
</div>

This goes through the BUILD process with no errors but when I'm in admin and select a page to edit I get the following CMS error and the page editor doesn't load.

Notice at line 174 of C:\xampp\htdocs\EveryComma\framework\dev\Deprecation.php

Any help would be appreciated.

Avatar
martimiz

Forum Moderator, 1391 Posts

1 November 2014 at 11:27pm

This is an older thread. I suppose you ar using version 3.1.x? In that case:

In earlier versions these statics were still suposed to be public, whereas in version 3.1 they must now be private, so that would explain that.

Also 'Root.Content.ColumnOne' is a version 2.4 remnant. In 3.1 this should be just 'Root.ColumnOne'

The error message is a bit sparse. Something like firebird in firefox will allow you to see more...