- 7.23. Opt_Generator_Interface
7.23.1. generate() - 7.23. Opt_Generator_Interface
« Previous - 7.24. Opt_Output_Interface class
Next »
7.23.1. generate()
| Construct | Abstract method |
|---|---|
| Visibility | public |
| Reference | mixed generate(string $what) |
| Argument list |
|
| Returned value | The section data. |
Generates the data for the section. The data format provides the section name with the $what attribute, so that one class may support different sections.
A sample generator:
class myGenerator implements Opt_Generator_Interface { public function generate($what) { return array(0 => array('item' => 'Item 1'), array('item' => 'Item 2'), array('item' => 'Item 3'), ); } // end generate(); } // end myGenerator; $view = new Opt_View('view.tpl'); $view->section = new myGenerator(); $view->setFormat('section', 'RuntimeGenerator/Array');
The template:
<?xml version="1.0" ?> <opt:root> <opt:section name="section"> <p>{$section.item}</p> </opt:section> </opt:root>
- 7.23.1. generate()
7.23. Opt_Generator_Interface - « Previous
7.23. Opt_Generator_Interface - Next »
7.24. Opt_Output_Interface class