Raw creation DTS:
1369025850
Formatted creation DTS:
2013 May 19
Raw wealth: $
2500.25
Formatted wealth: $
2,500
.tpl File
Raw creation DTS: {WFLabel id="creationDTS"}<br />
Formatted creation DTS: {WFLabel id="formattedCreationDTS"}<br />
Raw wealth: ${WFLabel id="wealth"}<br />
Formatted wealth: ${WFLabel id="formattedWealth"}<br />
shared.instances File
$__instances = array(
'unixDateFormatter' => 'WFUNIXDateFormatter',
'currencyFormatter' => 'WFNumberFormatter',
'person' => 'WFObjectController',
);
shared.config File
$__config = array(
'unixDateFormatter' => array(
'properties' => array(
'formatString' => 'Y M d',
),
),
'currencyFormatter' => array(
'properties' => array(
'decimalPlaces' => '0',
),
),
'person' => array(
'properties' => array(
'class' => 'Person',
),
),
);
.instances File
$__instances = array(
'creationDTS' => array('class' => 'WFLabel', 'children' => array()),
'wealth' => array('class' => 'WFLabel', 'children' => array()),
'formattedCreationDTS' => array('class' => 'WFLabel', 'children' => array()),
'formattedWealth' => array('class' => 'WFLabel', 'children' => array()),
);
.config File
$__config = array(
'creationDTS' => array(
'bindings' => array(
'value' => array(
'instanceID' => 'person',
'controllerKey' => 'selection',
'modelKeyPath' => 'creationDTS',
),
),
),
'wealth' => array(
'bindings' => array(
'value' => array(
'instanceID' => 'person',
'controllerKey' => 'selection',
'modelKeyPath' => 'wealth',
),
),
),
'formattedCreationDTS' => array(
'properties' => array(
'formatter' => '#module#unixDateFormatter',
),
'bindings' => array(
'value' => array(
'instanceID' => 'person',
'controllerKey' => 'selection',
'modelKeyPath' => 'creationDTS',
),
),
),
'formattedWealth' => array(
'properties' => array(
'formatter' => '#module#currencyFormatter',
),
'bindings' => array(
'value' => array(
'instanceID' => 'person',
'controllerKey' => 'selection',
'modelKeyPath' => 'wealth',
),
),
),
);
Module Code
class formatters extends WFModule
{
function defaultPage()
{
return 'example';
}
function sharedInstancesDidLoad()
{
$this->person->setContent(Person::personByID(1));
}
}