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.

General Questions

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

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

SiteConfig customisation results in error on save


Reply

4 Posts   478 Views

Avatar
jizzman

30 March 2012 at 1:19am Community Member, 23 Posts

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

4 April 2012 at 5:36am Forum Moderator, 1796 Posts

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

4 April 2012 at 12:31pm (Last edited: 4 April 2012 2:21pm), Community Member, 23 Posts

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

4 April 2012 at 8:35pm Forum Moderator, 1095 Posts

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.