Hi there,
init_module calls construct method in main class of created module.
Aditionally init_module gets array of arguments as second parameter and name of module as third argument.
Example:
class Apps_CoolHint extends Module {
public function construct($arg1, $arg2) {
$x = $this->get_instance_id(); //name passed in init_module
$path = $this->get_path(); //interesting method... gives you unique name of this module instance
//don't print anything here because it won't be displayed....
}
public function body($arg) {
print($arg); //called on display_module, in this example prints 'Message on hint'
}
public function show() {
print('foo');
}
}
and somewhere:
$mod = & $this->init_module('Apps/CoolHint',array('arg1','arg2'),'name_of_module_instance');
$this->display_module($mod, 'Message on hint');
or:
$this->pack_module('Apps/CoolHint','Message on hint','body',array('arg1','arg2'),'name_of_module_instance');
If you don't use construct, or construct doesn't take arguments, you can omit third, fourth and fifth argument of pack_module
'body' is a method that is called by default on display_module() and it is module output.
If you just call 'show' method, it will be printed out in parent module and classified as a part of parent output.
Sometimes it's good(output filters modules, ex. Base/Lang, Utils/Tooltip), but usually you don't want it.
If you want to use themes to describe layout:
http://www.epesi.org/index.php/Base/Theme