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.
<?php
//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");
exit;
}
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.
Great post.
Allѕo visit my web ƅlog :: Just how much is a full Week inside thailand going to price?
In what folder to put the file ‘mod-custom_module.tpl‘
thank you
Put it in templates/modules/
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.
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.
I do not even know the way I ended up right here, but I believed this submit
was once great. I don't know who you might be but definitely you're going to a well-known blogger
should you aren't already. Cheers!