print

5. My First Module — Full Screen/Full Page Mode

You are here: C97net4. Modules

Create your first module... as simple as Hello World

info 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:

Hello World

<?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.

Skin Inclusion

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);
?>

Complex Modules

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?

read more More Comments/Post Your Own

Account

Search

Tags

acp add all also any create default display don download easy echo etc features field file files folder form function includes information init kemana link list may module name need number own page php please qengine read require script set site skin time tpl url use user using version welcome