Jump to:

5451 Posts in 1673 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Title and content fields gone in the CMS??

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

Page: 1
Go to End
Author Topic: 904 Views
  • Hat-Rack
    Avatar
    Community Member
    12 Posts

    Title and content fields gone in the CMS?? Link to this post

    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
  • Hat-Rack
    Avatar
    Community Member
    12 Posts

    Re: Title and content fields gone in the CMS?? Link to this post

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

  • Anatol
    Avatar
    126 Posts

    Re: Title and content fields gone in the CMS?? Link to this post

    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

  • Hat-Rack
    Avatar
    Community Member
    12 Posts

    Re: Title and content fields gone in the CMS?? Link to this post

    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!

  • Anatol
    Avatar
    126 Posts

    Re: Title and content fields gone in the CMS?? Link to this post

    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

  • Hat-Rack
    Avatar
    Community Member
    12 Posts

    Re: Title and content fields gone in the CMS?? Link to this post

    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!

    904 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.