Using strategies

Don't know about view_strategies? read more here

View_strategy objects provide a predefined behavior that includes block and subblocks names, this reduces the amount of code required for an standard (generated or cloned) page. However all this can be overridden in order to adjust to any template.

Strategies provide extra methods to add language resources as well as block and subblock level vars, some of this will be processed (values replaced) while some others are just assigned.

Strategies are like any other object. They follow a common interface ‘view’ and inherit methods from view_strategy class.

Specific parameters for extra functionality provided by a strategy are not standard.

Please Check the list of available /shared methods on the documentation.

Example:

$v = new view_alternate_table($this->template, $vo_array, array('parent'=>'List'));

$v->addlang('label','view');

$v->addblocklang('label');

$v->addbtn('addNew','?task=im_accounts&mode=addNew',true);

$v->addfield("viewLink", "index.php?task=im_accounts&mode=View&I_IDACCOUNT={I_IDACCOUNT}");

$v->getview();

Using the right combination of code complex YUI trees, alternate tables, and diagrams can be generated with minimum code writing.

Strategies become more useful when large VO's are used in your system