How to create custom module in TikiWiki

TikiWiki or simply Tiki, is a free and open source wiki-based, content management system and Online office suite written primarily in PHP. Tiki is a powerful all-in-one web-based application, offering collaboration, publishing, commerce, social networking, CRM and office productivity tools. If you have just started your Tiki development then you will frequently need to create custom modules in TikiWiki. In this article I will tell you how to create your custom TikiWiki module from scratch. For creating you own module, you need to add two files in TikiWiki:

  • A php module file
  • A smarty template file

Create the PHP module file

Suppose the name of your module is ‘Custom Module’, then your module file will be named as ‘mod-func-custom_module.php‘. This file will contain two important functions. The function with ‘_info‘ as suffix will contain the basic information of your module like name, description, required parameters etc. The second function ‘module_<module_name>‘ will contain the core functionality of your module.

//this script may only be included - so its better to die if called directly.
if (strpos($_SERVER["SCRIPT_NAME"],basename(__FILE__)) !== false) {
header("location: index.php");

function module_custom_module_info() {
return array(
'name' => tra('Custom Module'),
'description' => tra('This is a custom module.'),
'prefs' => array( ),
'params' => array(
'username' => array(
'required' => true,
'name' => tra('Username'),
'description' => tra('Please enter username.')
'Email' => array(
'required' => true,
'name' => tra('email'),
'description' => tra('Please enter Password')
'required' => true,
'name' => tra('db'),
'common_params' => array('nonums', 'rows')

#Create the module function
function module_custom_module( $mod_reference, $module_params ) {
global $smarty, $tikilib, $user;

#Get module parameters
$username = $module_params['username'];
$email = $module_params['email'];

$smarty->assign('username', $username);
$smarty->assign('email', $email);

Create the PHP smarty template file

TikiWiki uses smarty as the template engine. Template file is mandatory for module creation. Each module has a separate template file. The convention for naming the template file is as ‘mod-<module_name>.tpl‘. So our module template file will be ‘mod-custom_module.tpl‘. In this file we will print the smarty variables assigned in the module PHP file.

Username: {$username}
Email: {$email}

Don’t forget to clear your TikiWiki cache before the new module can appear in the modules list.

Written by Arvind Bhardwaj

Arvind is a Magento and WordPress expert with more than 6 years of industry wide experience.


6 thoughts on “How to create custom module in TikiWiki

  1. I've read some good stuff here. Definitely price bookmarking for revisiting.
    I wonder how so much attempt you put to make this type of great informative website.

  2. Excellent goods from you, man. I have understand
    your stuff previous to and you're just too excellent.
    I really like what you've acquired here, certainly like what you're
    stating and the way in which you say it. You make it entertaining and you still take care of to keep it sensible.
    I can't wait to read far more from you. This is actually a tremendous website.

Comments are closed.