Jump to:

23490 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » "Global site info" question

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

Page: 1
Go to End
Author Topic: 1447 Views
  • Karamba
    Avatar
    Community Member
    3 Posts

    "Global site info" question Link to this post

    Hi, all.

    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?

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: "Global site info" question Link to this post

    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.

  • Nathan Cox
    Avatar
    Community Member
    99 Posts

    Re: "Global site info" question Link to this post

    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.

  • Karamba
    Avatar
    Community Member
    3 Posts

    Re: "Global site info" question Link to this post

    Thank you.

    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.

  • dospuntocero
    Avatar
    Community Member
    54 Posts

    Re: "Global site info" question Link to this post

    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) %>
       $Phone
    <% end_control %>

    all your pages will be able to read the field

    1447 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.