Website Baker modules consists of text files such as PHP, HTML, Javascript and CSS. This chapter provides a brief introduction of the different module files and its purpose depending on the different module types. This is the basic knowledge required for the creation of own modules.
There are two files which are required (or recommended) for all modules:
<?php
/**
Copyright (C) 2007, Christian Sommer
This module is free software. You can redistribute it and/or modify it under
the terms of the GNU General Public License - version 2 or later, as published
by the Free Software Foundation: http://www.gnu.org/licenses/gpl.html.
This module is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-------------------------------------------------------------------------------
Modul: XXX für Website Baker v2.6.x (http://www.websitebaker.org)
Short module description here
-------------------------------------------------------------------------------
v0.10 (Christian Sommer; 11.06.2007)
+ initial release of the module
-------------------------------------------------------------------------------
**/
$module_directory = 'module directory';
$module_name = 'module name (shown as new page type)';
$module_function = 'page, tool or snippet';
$module_version = '0.10';
$module_platform = '2.6.x';
$module_author = 'Christian Sommer';
$module_license = 'GNU General Public License';
$module_description = 'short description of the modules purpose';
?>
The opening PHP tag (<?php) is followed by a multiline comments block (/** ... **/) which provides optional information about the choosen module license, a disclaimer and the module development history.
The module variables provides the required information for Website Baker. The variable $module_function defines whether the module is a page type module (page), a administration tool (tool) or a code snippet (snippet). The info.php file ends with the closing PHP Tag (?>).
The index.php file prevents the listing of files and folder contained in the module directory independent of your server settings. This is a simple measure to enhance security as no additional information about the module architecture will be displayed.
<?php
header('Location: ../index.php');
?>
The following files are optional and can be used to execute code during installation and uninstallation process. This files are automaticall invoked from the Website Baker backend: Add-Ons -> Module -> Install Module / Uninstall Module.
The content of those files depends from the modules purpose. A working example can be found with the Hello World Module from the Add-Ons Repository.
A page type module requires to set the variable in the info.php as follows:
$module_function = page;
Page type modules can contain the following files:
The content of those files depends from the modules purpose. A working example can be found with the Hello World Module from the Add-Ons Repository.
A administration tool requires to set the variable in the info.php as follows:
$module_function = tool;
Administration tools contain the following file:
A code snippet requires to set the variable in the info.php as follows:
$module_function = snippet;
All functions contained in the following file can be invoked from the index.php file of your template or from a page/section of type code:
Copyright (c) 2007 Website Baker Help team
Text and images of this page are licensed under a Creative Commons Attribution-NonCommercial-No Derivative 3.0 Licence. You are free to copy and distribute this work for noncommercial purposes as long as no changes are applied and this copyright notice and a backlink to http://help.websitebaker.org are provided.