21491 Posts in 5783 Topics by 2621 members
| Go to End | ||
| Author | Topic: | 1131 Views |
-
Re: Operations on variables

31 January 2012 at 2:04pm
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!
-
Re: Operations on variables

1 February 2012 at 6:03am
From the Page_Controller you can access the Uk value by doing:
$num = $this->SiteConfig()->Uk;
| 1131 Views | ||
| Go to Top |

