cool thanks!
b
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
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.
cool thanks!
b
How would you add a variable defined in a customsite config to this?
For example if you set a exchange rate in a CustomSiteConfig, then wanted to use in this where the $num is?
in Page.php :
function eaPayment() {
$num = 4; //replace this value with a variable from customsite config UK below
$total = $this->Total;
$ea = $total/$num;
return $ea;
}
in CustomSiteConfig.php :
class CustomSiteConfig extends DataObjectDecorator {
function extraStatics() {
return array(
'db' => array(
class CustomSiteConfig extends DataObjectDecorator {
function extraStatics() {
return array(
'db' => array(
'Uk' => 'Decimal'
)
);
}
Thanks in advance!
From the Page_Controller you can access the Uk value by doing:
$num = $this->SiteConfig()->Uk;
Thanks, that worked!