Location: PHPKode > projects > AModules3 > amodules-3.0.1/samples/01-hello_world/hw5.php
 * Hello World 5
 * Guess what ?
 * Inside previous demo we were not using existing resources of AModules3 effective enough.
 * Lister is a class of AModules3 which will help to output our data. There are few variations
 * of Lister:
 *  Lister (works with DB query)
 *  ArrayLister (works with array)
 *  CompleteLister (uses more complicated template)
 *  CompleteArrayLister (uses more complicated structure and works with array)
 * Also, now that we use existing class, there are no need to have our own class. So
 * this example does the same thing as the previous one, but it does not introduce
 * any new classes.

include '../../trunk/loader.php';

 * We do not need a custom class anymore. Of course we could use one, but
 * I wanted to show that our default classes can do a lot without customization

$api = new ApiWeb('hw5');
$api->template = $api->add('SMlite')->loadTemplate('hw');   // using file templates/hw.html

$api->template->set('page_title','Hello world application');

 * Since we will be adding one sub-element into our hello world, we'll have
 * to make it container for other elements. In AModules any element can be
 * a container. add() method is used. As a basic container we will use 
 * View class
 * We are going to put ArrayLister inside our container
$cont = $api->add('View',null,'page_content',array('widgets','hw4'));
$cont->template->set('title','Hello to ..');

 * ArrayLister will display itself for each row in $data array. It will
 * re-use it's own template and insert into specified spot ('row', 3rd arg)
$list = $cont->add('Lister',null,'rows','row');

Return current item: AModules3