23377 Posts in 18296 Topics by 2867 members
|Go to End|
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.
24 February 2009 at 2:41am
aram, its very sad that SS have no special solution for this task. I think that this functionality is required for big percent of sites.
Nathan, your solution was the first idea in my head. Unfortunately i am not so good in SS now for doing module by self hands.
P.S. The "Subscribe to this topic" checkbox not work for me. I don't receive mails about your posts.
7 December 2009 at 1:41am
You can do a very simple trick.
create the $Phone field in the homepage in a tab called contact details for example and then in your templates use. Im assuming that the same phone will be showed in every page
<% control Page(home) %>
<% end_control %>
all your pages will be able to read the field
|Go to Top|