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.

Customising the CMS

Title and content fields gone in the CMS??


Reply

6 Posts   961 Views

Avatar
Hat-Rack

7 March 2009 at 8:46pm Community Member, 12 Posts

I have just logged into my CMS and there seems to be some title and content fields missing!

Please see the attached screenshots. When I click on Point 5 (1st screenshot) all is fine as there are areas where I can enter information into. When I click on any other tab except point five (In this case point1, point2, point3 and point 4) I get a blank page with no textboxes to enter information into.

This is quite a weird problem. Was running fine a few days ago. I did upgrade the site to 2.3.0 but why would point 5 work while the others dont?

Wondering if anyone has any ideas?

Attached Files
Avatar
Hat-Rack

10 March 2009 at 8:10am Community Member, 12 Posts

I'm still stuck on this issue, has anyone come across this before?

Avatar
Anatol

10 March 2009 at 12:34pm (Last edited: 11 March 2009 12:46pm), 126 Posts

Hi,

It's hard to say anything based on the screenshots. How did you add the fields and tabs in the CMS? Something like ...

class Page extends SiteTree {

public static $db = array(
"point1title" => "Text",
"point2title" => "Text"
// etc
);

function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.PointOne", new TextField("point1title", "Title"));
$fields->addFieldToTab("Root.Content.PointTwo", new TextField("point2title", "Title"));
// etc
return $fields;
}

// etc ...

Some code would be easier to troubleshoot.

Cheers!
Anatol

Avatar
Hat-Rack

11 March 2009 at 9:55am Community Member, 12 Posts

Here is my code:

class HowPage extends Page {
static $db = array(
   'item1Title' => 'Text',
   'item1Content' => 'HTMLText',
   'item2Title' => 'Text',
   'item2Content' => 'HTMLText',
   'item3Title' => 'Text',
   'item3Content' => 'HTMLText',
   'item4Title' => 'Text',
   'item4Content' => 'HTMLText',
   'item5Title' => 'Text',
   'item5Content' => 'HTMLText',

   
);
static $has_one = array(
);

function getCMSFields() {
   $fields = parent::getCMSFields();
   $fields->addFieldToTab('Root.Content', new TabSet('PointOne'));
   $fields->addFieldToTab('Root.Content', new TabSet('PointTwo'));
   $fields->addFieldToTab('Root.Content', new TabSet('PointThree'));
   $fields->addFieldToTab('Root.Content', new TabSet('PointFour'));
   $fields->addFieldToTab('Root.Content', new TabSet('PointFive'));
   $fields->addFieldToTab("Root.Content.PointOne.Title", new TextField('item1Title','Title'));
   $fields->addFieldToTab("Root.Content.PointOne.Content", new HTMLEditorField('item1Content','Content'));
   $fields->addFieldToTab("Root.Content.PointTwo.Title", new TextField('item2Title','Title'));
   $fields->addFieldToTab("Root.Content.PointTwo.Content", new HTMLEditorField('item2Content','Content'));
   $fields->addFieldToTab("Root.Content.PointThree.Title", new TextField('item3Title','Title'));
   $fields->addFieldToTab("Root.Content.PointThree.Content", new HTMLEditorField('item3Content','Content'));
   $fields->addFieldToTab("Root.Content.PointFour.Title", new TextField('item4Title','Title'));
   $fields->addFieldToTab("Root.Content.PointFour.Content", new HTMLEditorField('item4Content','Content'));
   $fields->addFieldToTab("Root.Content.PointFive.Title", new TextField('item5Title','Title'));
   $fields->addFieldToTab("Root.Content.PointFive.Content", new HTMLEditorField('item5Content','Content'));
   return $fields;
   }
}

class HowPage_Controller extends Page_Controller {
   

   
   
}

Funny thing is I haven't touched this page. What I have done is upgrade to SS 2.3.0 and migrated everything to a host. The database came across fine as there is old information in it that displays on the page fine. I just cant see any fields in the CMS to update the information. It's a weird prob!

Avatar
Anatol

11 March 2009 at 11:11am 126 Posts

Hi,

yes, really weird why it does not work since you updated to Silverstripe 2.3 . I had a quick try with your code in my Silverstripe 2.3 installation and made a few modifications, and it worked. You don't have sub tabs for title and content any more - but from a usability point of view I would keep both fields under one tab anyway. try this instead:

function getCMSFields() {
      $fields = parent::getCMSFields();
      $fields->addFieldToTab("Root.Content.PointOne", new TextField('item1Title','Title'));
      $fields->addFieldToTab("Root.Content.PointOne", new HTMLEditorField('item1Content','Content'));
      $fields->addFieldToTab("Root.Content.PointTwo", new TextField('item2Title','Title'));
      $fields->addFieldToTab("Root.Content.PointTwo", new HTMLEditorField('item2Content','Content'));
      $fields->addFieldToTab("Root.Content.PointThree", new TextField('item3Title','Title'));
      $fields->addFieldToTab("Root.Content.PointThree", new HTMLEditorField('item3Content','Content'));
      $fields->addFieldToTab("Root.Content.PointFour", new TextField('item4Title','Title'));
      $fields->addFieldToTab("Root.Content.PointFour", new HTMLEditorField('item4Content','Content'));
      $fields->addFieldToTab("Root.Content.PointFive", new TextField('item5Title','Title'));
      $fields->addFieldToTab("Root.Content.PointFive", new HTMLEditorField('item5Content','Content'));
      return $fields;
}

The "new TabSet" is not even necessary.

Cheers!
Anatol

Avatar
Hat-Rack

11 March 2009 at 6:55pm Community Member, 12 Posts

Well, believe it or not, I put that code in and it solved it. Very weird. It's laid out much better now. Thanks very much for your help Anatol!