Classes, interfaces and traits
PVHtml¶
PVHTML is a class designed for generating HTML elements to display to the user.
The class takes in basic HTML forms with options. The functionality can be used with dynamic form generation tools.
Example:
```php
//Create array of links
$links = array('Google', 'http://www.google.com', 'Facebook', 'http://www.facebook.com');
$html = '';
$li = '';
foreach($links as $key => $value):
$li .= PVHtml::li(PVHtml::ahref($key, $value));
endforeach;
$html = PVHtml::ul($li);
$html = PVHtml::div($html, array('class' => 'container'));
echo $html;
//The following will be printed
<div class="container">
<ul>
<li><a href="http://www.google.com">Google</a><li>
<li><a href="http://www.facebook.com">Facebook</a><li>
</ul>
</div>
```
« More »
PVTemplate¶
PVTemplate is a generic template wrapper class that is used as a basis for creating a templating system.
ProdigyView comes with the ability to implement adapters, intercepting filters and observers. Extending this class to a child class will give the child class the ability to use those design patterns along with a collection that can assign and retrieve values using magic functions.
```php
Example:
//Create the class
class Example extends PVObject {
public static function testMe($string) {
echo $string;
//An observer
$this->_notify(get_class() . '::' . __FUNCTION__, $string);
}
}
//Add to its collection
Example::set('foo','bar');
echo Example::get('foo');
//Add a dynamic method
Example::addMethod('fiz', function($text) {
return 'fiz ' . $text;
});
echo Example::fizz('Bop');
//Add Observer
Example::addObserver('Example::testMe', 'test_closure', function($string) {
echo "\nLine 2 \n"
echo $string;
}, array('type' => 'closure'));
//Will call test me and the observer attached
Example::testMe('Testing String ');
```
« More »