You are here: C97net • 4. Modules
Create your first module... as simple as Hello World
To continue learning about modules, please download demo module. The following information will be based on demo module.
This chapter will cover full screen mode module. Even your module doesn't have windowed mode, you must still have window.php (see Full Page vs Inline).
Full screen mode requires the following files:
<?php
$txt['main_body'] = 'Hello world!';
?>
Simple, eh. You don't need to include user_init.php, or use flush_tpl(), everything will be taken care by qE.
If you need to use a skin file .tpl, load it with load_tpl ('mod', [skin_name]); This also true for windowed mode. By using 'mod' parameter, qE will try to load module skin from current skin, and if the specified file not found, qE will attempt to load from default skin. And if the file still not found, it will exit the script.
<?php
$tpl = load_tpl ('mod', 'module_myskin.tpl');
$row['something'] = 'something';
$txt['main_body'] = quick_tpl ($tpl, $row);
?>
A complex module may require more than one file. To do so, the structure of files should be:
Pay attention to main.php, as qE only allow you to load main.php, you can't force qE to load your other files. So use this method:
<?php
$cmd = get_param ('cmd');
switch ($cmd)
{
case 'read':
require ('./module/demo/other.php');
break;
case 'cat':
require ('./module/demo/another.php');
break;
case 'list':
require ('./module/demo/yetanotherfile.php');
break;
}
?>
There is no comment. Why not be the first?