22 February 2009 at 7:01am
I have a phone number in the head section and need it to be editable from cms. Now i have a text field with this field on content tab of HomePage. And i do sql query when i parse it in every page code.
Question: is there in SS special place for "global" fields as a phone in head section?
22 February 2009 at 8:43am
Hi Karamba, welcome to Silverstripe :)
Unfortunately i don't think this is possible. I always though it would b great if you could add fields to the top 'Site Content' item on the site tree, but as far as I know there is no way to do that without going into the core files.
Of course you could always create a page type 'Global content', but then as far as I know you cant set a limit on the number of a certain page type is created so a user could create a number of these pages and potentially screw things up.
23 February 2009 at 1:34pm
My solution here was to make a module that puts a "Site Settings" item in the CMS main menu. In there I had a form that saves everything to Site Setting data objects, and made a Page_Controller decorator that fetches them for use in the templates. I used it to set things like contact details, "global" meta data, taglines and whatnot.
I think it would make alot more sense to have a settings page like that at the root of the Site Tree, from a user point of view, but I had a look at the files there once and it didn't look like a fun thing to try hack.
Of course if you're using 2.3 you could manage settings with a ModelAdmin page but it's not a very user friendly interface for someone who just wants to set one or two variables.