Jump to:

1374 Posts in 487 Topics by 520 members

Themes

SilverStripe Forums » Themes » Honey, I broke the CMS...

Discuss SilverStripe Themes.

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

Page: 1 2
Go to End
Author Topic: 1496 Views
  • arthurdent
    Avatar
    Community Member
    152 Posts

    Honey, I broke the CMS... Link to this post

    Well, not exactly BROKE it... but it's doing some pretty hoopy stuff...

    I wanted to add an editable sidebar to my page so I updated Page.php as follows:

    <?php

    class Page extends SiteTree {

    static $db = array(
    'SidebarHTML' => 'HTMLText'
    );

    static $has_one = array(
    );

    function getCMSFields() {
    $fields = parent::getCMSFields();
    $fields->addFieldToTab("Root.Sidebar", new HtmlEditorField( "SidebarHTML"));
    return $fields;

    }

    }

    class Page_Controller extends ContentController {

    }

    ?>

    The CMS still works -- after a fashion. I have a new tab in the CMS called 'Sidebar'. I can edit content in main field and in 'sidebar' and write to the DB. It's only when I 'save' the page that the funky stuff happens. I get a facefull of goobledegook, (see screenshot) hit refresh and suddenly all is well...

    Unfortunately I'm a designer who is still coming to terms with PHP -- so I can't see anything wrong with the code. It worked in older projects but doesn't seem to like SilverStripe 3... am I calling on a resource that has been deprecated / removed?

    Any advice gratefully appreciated!!

  • Webdoc
    Avatar
    Community Member
    332 Posts

    Re: Honey, I broke the CMS... Link to this post

    try to flush your site yoursitename.com/?flush=all

    ---------------------------------------------------------------
    Arvixe Web Hosting / SilverStripe Community Liaison | Looking for quality SilverStripe Web Hosting? Look no further than Arvixe Web Hosting!

  • arthurdent
    Avatar
    Community Member
    152 Posts

    Re: Honey, I broke the CMS... Link to this post

    Great idea thanks, but it's been '/dev/build/' and well flushed, still acting up though.

  • arthurdent
    Avatar
    Community Member
    152 Posts

    Re: Honey, I broke the CMS... Link to this post

    OK, just for fun I thought I'd try my code in the last version of SilverStripe 2... 2.4.9

    It doesn't have a spazz like SS3 - just quietly sits there spinning its wheels. Data is actually written to DB but it's not the sort of thing you want to show to your average user...

    PLEASE... can anybody tell me what's going on?!!

  • arthurdent
    Avatar
    Community Member
    152 Posts

    Re: Honey, I broke the CMS... Link to this post

    Back to SS3 - now it's lost my theme and is showing default page only. WTF is going on? Pretty sure by entire DB is screwed now/ How do I get things back on trac. Been farting around with PHP MyAdmin to no avail. Whys are DBs so fragile? Does anybody read these forums apart from me?

    Yes, I'm really pissed now. Be really great if there was SOME supporting documentation!!

  • simon_w
    Avatar
    Forum Moderator
    471 Posts

    Re: Honey, I broke the CMS... Link to this post

    That looks like you have excess whitespace being outputted to the browser. Check your files for spaces before the opening <?php tag and remove the closing ?> tags (they're not required and are really good at hiding extra whitespace).

    As for the theme, make sure that it's set properly in admin/settings and that you've flushed after changing it.

  • kiwidude95
    Avatar
    Community Member
    25 Posts

    Re: Honey, I broke the CMS... Link to this post

    Your file may not be encoding correctly which is why your Admin backend of your SilverStripe site has gone buggy!
    Try using notepad and recreate the file without copy and pasting. After doing so, make sure the encoding is set to UTF-8!

    Once you've done that, it might work!

  • arthurdent
    Avatar
    Community Member
    152 Posts

    Re: Honey, I broke the CMS... Link to this post

    simon_w and kiwidude95, thanks for your suggestions. I've been through Page.php and taken out every space that I can see. I ensured that encoding was set to UTF-8, flushed and rebuild DB (several times). Further to simon_w's suggestion I also ensured that admin/settings were set correctly. When I tried to edit a page again I got a slightly different result -- large grey panels appeared!! Wow!!

    Any further insights anyone?

    Attached Files
    1496 Views
Page: 1 2
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.