Your getCMSFields() method needs to be INSIDE your Page class - not outside the braces as you currently have it
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.
- Previous 10 entries
- 1
- Page 22(current)
- 3
- Next 10 entries
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.
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.
:)
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;
}
}
Antti - have you rebuilt the database by going to yoursite.com/dev/build?
Thank you willr.
Dont know how i missed that. I realy should consentrate more while reading...
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.
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...
- Previous 10 entries
- 1
- Page 22(current)
- 3
- Next 10 entries