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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

SiteConfig customisation results in error on save


Go to End


4 Posts   878 Views

Avatar
jizzman

Community Member, 23 Posts

30 March 2012 at 1:19am

Hi,

I'm trying to get my site live for the first time. When I save my CustomSiteConfig I get an error. Firebug says:

"You don't have permission to access <site>/admin/RootForm on this server."

I've tracked it down to this field I added. Remove this and the error goes away.

$navViewer = new HtmlEditorField_Readonly('NavMenu_', 'Navigation');
$fields->addFieldToTab('Root.NavigationMenu', $navViewer);

I have my own code to generate a navigation menu (onbeforeWrite()) and save the HMTL result in the SiteConfig table. I was just trying here to show a read-only view of the generated menu (I was thinking of adding a proper 'generate' button). With a fresh installation, the very first save works, but after that it wont work again. I never had this problem on my dev machine.

Any clues?

Cheers,
J

Avatar
swaiba

Forum Moderator, 1899 Posts

4 April 2012 at 5:36am

I don't know - I suspects it's something that is based on file paths and seperators - assuming you are using a unix machine for live and an non-unix machine for dev.

However - I'm really not sure why you wouldn't do the normal thing and use the templating engine for rendering page elements - it's what it is there for and I've never had an issue creating many different types of menus...

Avatar
jizzman

Community Member, 23 Posts

4 April 2012 at 12:31pm

Edited: 04/04/2012 2:21pm

Hi,

I would like to do the normal thing! I had a need to create drop down menus where the 2nd level would sometimes be child pages (directly supported by SS) but sometimes be heading anchors on a root level page (not directly supported by SS, as far as I know). So I wrote a little bit of code to parse the page, find the heading anchors, and generate a list for my menu. Worried about the site growing and performance (which admittedly I have little experience with) I save the generated menu to the database. I'm happy with the result, but is there an easier way?

Thanks,
J

P.S. As for Windows vs Linux: I rebuilt the database manually - from scratch - on the Linux server to 1) test my CMS development 2) avoid any Window path problems. Apart from a css include path problem in my page_controller::init() I've had no other cross-platform issues.

Avatar
martimiz

Forum Moderator, 1391 Posts

4 April 2012 at 8:35pm

If it's just the performance you're worried about, you could consider using partial caching for your menu's (http://doc.silverstripe.org/sapphire/en/reference/partial-caching).

The only cactch is that menu's might not update right away after every change - but I suppose, if it were very important, some clever coding could handle that.