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

Tutorial 2: New fields not showing up on CMS


Reply


5 Posts   1632 Views

Avatar
DonL

Community Member, 9 Posts

6 July 2008 at 5:45am

I've added the $Author and $Date code to ArticlePage.php and flushed both the DB and the CMS, but the fields still aren't showing up in the CMS. Any ideas what to look for?

<?php
/**
* Defines the ArticlePage page type
*/
class ArticlePage extends Page {
static $db = array(
   'Date' => 'Date',
   'Author' => 'Text'
);
static $has_one = array(
);

static $allowed_children = array('ArticlePage');

}

class ArticlePage_Controller extends Page_Controller {

}

function getCMSFields() {
$fields = parent::getCMSFields();

$fields->addFieldToTab('Root.Content.Main', new CalendarDateField('Date'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new TextField('Author'), 'Content');
   
return $fields;
}

?>

The DB has been updated - the pages are there when I re-flush.

Building Database

Creating database tables
# Newsletter
# Newsletter_SentRecipient
# Newsletter_Recipient
# NewsletterType
# PageComment
# Email_BounceRecord
# Email_BlackList
# PageView
# SiteTree
# QueuedEmail
# File
# EditableCheckboxOption
# EditableDropdownOption
# EditableFormField
# EditableRadioOption
# SubmittedForm
# SubmittedFormField
# Group
# Member
# Member_UnsubscribeRecord
# Permission
# Widget
# WidgetArea
# GhostPage
# Page
# UserDefinedForm
# ErrorPage
# RedirectorPage
# VirtualPage
# ArticleHolder
# ArticlePage
# HomePage
# SubscribeForm
# Image
# Folder
# Image_Cached
# EditableCheckbox
# EditableCheckboxGroupField
# EditableDateField
# EditableDropdown
# EditableEmailField
# EditableFileField
# EditableFormHeading
# EditableMemberListField
# EditableRadioField
# EditableTextField
# SubmittedFileField
# Group_Unsecure

Creating database records
# Newsletter
# Newsletter_SentRecipient
# Newsletter_Recipient
# NewsletterType
# PageComment
# Email_BounceRecord
# Email_BlackList
# PageView
# SiteTree
# QueuedEmail
# File
# EditableCheckboxOption
# EditableDropdownOption
# EditableFormField
# EditableRadioOption
# SubmittedForm
# SubmittedFormField
# Group
# Member
# Member_UnsubscribeRecord
# Permission
# Widget
# WidgetArea
# GhostPage
# Page
# UserDefinedForm
# ErrorPage
# RedirectorPage
# VirtualPage
# ArticleHolder
# ArticlePage
# HomePage
# SubscribeForm
# Image
# Folder
# Image_Cached
# EditableCheckbox
# EditableCheckboxGroupField
# EditableDateField
# EditableDropdown
# EditableEmailField
# EditableFileField
# EditableFormHeading
# EditableMemberListField
# EditableRadioField
# EditableTextField
# SubmittedFileField
# Group_Unsecure

Avatar
Sean

Forum Moderator, 922 Posts

6 July 2008 at 9:57am

Easy, your getCMSFields() function needs to go inside the ArticlePage class. You've currently got it outside of it.

Avatar
DonL

Community Member, 9 Posts

6 July 2008 at 10:46am

Oops! Heh.

Avatar
DonL

Community Member, 9 Posts

7 July 2008 at 4:21am

Well, I've moved getCMSFields into the controller, flushed everything... and still don't see the fields in the CMS.

Avatar
simon_w

Forum Moderator, 474 Posts

7 July 2008 at 7:18am

It should be in the ArticlePage class, not ArticlePage_Controller.