5. My First Module

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:

  • /module/[mod_name]/window.php
  • /module/[mod_name]/main.php
  • /skins/[skin_name]/module_[skin_file].tpl, if required

Hello World

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

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

  • /module/[mod_name]/window.php
  • /module/[mod_name]/main.php
  • /module/[mod_name]/otherfile.php
  • /module/[mod_name]/anotherfile.php
  • /module/[mod_name]/yetanotherfile.php
  • /skins/[skin_name]/module_[skin_file].tpl, if required

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:

$cmd = get_param ('cmd');
switch ($cmd)
case 'read':
require ('./module/demo/other.php');

case 'cat':
require ('./module/demo/another.php');

case 'list':
require ('./module/demo/yetanotherfile.php');


There is no comment. Why not be the first?

More Comments/Post Your Own

Online Users
There are 142 users online.

Connect with us on Facebook


Subscribe to our newsletter for the latest updates and exciting promotions!