23581 Posts in 19403 Topics by 2893 members
|Go to End|
1 May 2014 at 10:15pm
I would like to ask you a very basic question. I wanted to make tab 'contacts' in admin page edit where will be everything. From phone numbers, address, to social links. It works like a charm, even in templates I used <% if $Twitter, etc..
But then I found that what I put in is tied to one page, based on page ID. But, I would like to have those contacts as global var, so I can set them once (admin frontend update required) and have them available across all pages, includes, etc..
How to do it properly? Or do I have to make some contact module for it?
4 May 2014 at 9:03pm Last edited: 4 May 2014 9:03pm
That is where the SiteConfig class comes in - see the Settings menuitem in the left menubar. Here you can add your sitewide settings. The way to do that is create a DataExtension for the SiteConfig, and access its properties from the template as $SiteConfig.SomeProperty. The Silverstripe docs will tell you more:
4 May 2014 at 10:09pm
can it be that easy? I followed instructions on that link you posted and solved it in five minutes.
Thank you very much for your help. Now it works across whole page and its nicely wrapped in settings.
Thanks, have a nice day
|Go to Top|