17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 911 Views |
-
Page.php and Adding Fields

20 June 2008 at 8:21am Last edited: 20 June 2008 8:22am
Hi,
I've gone through the tutorials on setting up and extending a site with SilverStripe. I added the news section like the tutorial said, however when I go back to perform the same basic action of adding a new field to the "Page" page, upon saving or publishing the ajax loading graphic just spins like it can't save. I added a masthead image field and below is my code, if anyone can help me I'd appreciate it. This is the last thing on my to-do list for this site and I was hoping it would be easy. Thanks.
(Note: the calltoaction function works perfectly).
<?php
class Page extends SiteTree {
static $db = array('Masthead'=>'text');
static $has_one = array();
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', new TextField('Masthead', 'Masthead Image'), 'Content');
return $fields;
}
}class Page_Controller extends ContentController {
function CallToAction(){
$cat = DataObject::get_by_id('Page', 15);
return $cat;
}}
?>
-
Re: Page.php and Adding Fields

20 June 2008 at 1:51pm
I believe you need to have Text instead of text. FieldTypes are case sensitive I would assume
| 911 Views | ||
|
Page:
1
|
Go to Top |


