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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Widgets /

Discuss SilverStripe Widgets.

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

$SiteConfig.XX in Widget template?


Go to End


10 Posts   5331 Views

Avatar
Matty Balaam

Community Member, 74 Posts

2 December 2011 at 8:31pm

Edited: 02/12/2011 8:31pm

There is actually a better way Willr mentioned here:

http://www.silverstripe.org/widgets-2/show/18440

Use the following code in your widget:

function SiteConfig() {
return SiteConfig::current_site_config();
}

Avatar
Bureau Berg

Community Member, 7 Posts

13 March 2012 at 3:34am

Edited: 13/03/2012 3:34am

In PHP :
$config = SiteConfig::current_site_config(); //calling siteConfig values
$config->YouSiteConfigVariableName // get the value of the site config variable/field

In ss Template :
$SiteConfig.YouSiteConfigVariableName

Go to Top