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.

Widgets

Discuss SilverStripe Widgets.

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

$SiteConfig.XX in Widget template?


Reply

10 Posts   1967 Views

Avatar
Matty Balaam

2 December 2011 at 8:31pm (Last edited: 2 December 2011 8:31pm), Community Member, 69 Posts

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

13 March 2012 at 3:34am (Last edited: 13 March 2012 3:34am), Community Member, 7 Posts

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