<?
/*
* Hello World 3
*
* Here we'll try to create our own class responsible for drawing content of our page
*/
include '../../trunk/loader.php';
class HelloWorld extends AbstractView {
/*
* Our class won't be anything complex, so we won't even need to use a template.
* By default render() method would call $template->render(), but since we
* don't need that, we'll redefine it and output our message
*/
function init(){
$this->message = 'Hello world';
}
function render(){
$this->output($this->message);
}
}
$api = new ApiWeb('hw3');
$api->template = $api->add('SMlite')->loadTemplate('hw'); // using file templates/hw.html
$api->template->set('page_title','Hello world application');
//$api->template->set('page_content','Dynamic Hello world ('.rand().')');
$api->add('HelloWorld',null,'page_content');
/*
* Instead of manually assigning value to the region, we make our class: HelloWorld
* take care of that
*
*
* BTW, AModules3 already have 2 classes for you to play with:
* HelloWorld - is a very similar implementation to what we have in this file
* LoremIpsum - prints 5 paragrahs of standard filler-text
*/
$api->main();