PHOCOA PHP Framework

Raw creation DTS: 1414784577
Formatted creation DTS: 2014 Oct 31
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));
    }
}

Examples

Cookbook
  Widgets
  Bindings
  Pagination
  Formatters

Basic Examples
  Email
  Skin Browser
  Forms
  Regex Tester

AJAX Examples
  Infrastructure

  (YUI Examples)
  AutoComplete
  ColorPicker
  Menu
  Tree View
  Tab View
  Container

Appcelerator Integration
  Demo
Copyright (c) 2014 Alan Pinstein. All Rights Reserved.