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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Themes /

Discuss SilverStripe Themes.

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

Honey, I broke the CMS...


Go to End


11 Posts   5410 Views

Avatar
mhdesign

Community Member, 216 Posts

19 June 2013 at 6:44pm

Edited: 19/06/2013 6:50pm

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!!

Avatar
Webdoc

Community Member, 349 Posts

19 June 2013 at 11:55pm

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!

Avatar
mhdesign

Community Member, 216 Posts

20 June 2013 at 10:25am

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

Avatar
mhdesign

Community Member, 216 Posts

20 June 2013 at 3:31pm

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?!!

Avatar
mhdesign

Community Member, 216 Posts

20 June 2013 at 3:55pm

Edited: 20/06/2013 4:38pm

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!!

Avatar
(deleted)

Community Member, 473 Posts

20 June 2013 at 4:41pm

Edited: 20/06/2013 4:43pm

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.

Avatar
nzstephenf

Community Member, 63 Posts

23 June 2013 at 1:28am

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! :)

Avatar
mhdesign

Community Member, 216 Posts

26 June 2013 at 4:16pm

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
Go to Top