- 7.22. Opt_Component_Interface
7.22.3. display() - 7.22.2. defined()
« Previous - 7.22.4. get()
Next »
7.22.3. display()
| Construct | Abstract method |
|---|---|
| Visibility | public |
| Reference | void display([array $attributes = array()]) |
| Argument list |
|
display() should display the component. It is launched by the view in the place of opt:display tag. OPT passes the associative array of opt:display tag attributes as the $attributes argument. To render the HTML code, simply use echo statements, for example:
public function display($attributes = array()) { echo '<input type="text"'; foreach($attributes as $name=>$value) { echo ' '.$name.'="'.$value.'"'; } echo '/>'; } // end display();
Remember that the main purpose you should write components is the automation. Your components should be able to generate all the necessary attributes and tags without the help of the component users. Use the component parameters or even call your script API functions to get the necessary data.
- 7.22.3. display()
7.22. Opt_Component_Interface - « Previous
7.22.2. defined() - Next »
7.22.4. get()