DevWiki Index | DevWiki Tutorials
A minimal Xoops module
What's needed to make a minimal Xoops module? Let's find out:
Our minimal module only wants to print out the words 'Hello world' as a page of our xoops site. Let's start by creating a folder in the modules directory named 'minimal' with a file 'index.php' inside it:
<?php
/* index.php */
require_once("../../mainfile.php");
include XOOPS_ROOT_PATH."/header.php";
echo "Hello world!";
include XOOPS_ROOT_PATH."/footer.php";
?>
Let's go to the module administration panel of our Xoops site. Are we ready to install our module yet? No, the only Minimal thing we see is a line that repeats 'Module File for minimal Not Found!' So we need to read up on the xoops_version.php file: xoops_version.php
Create a file 'xoops_version.php' inside of your 'minimal' folder. Let's start it with:
<?php /* xoops_version.php */ $modversion['name'] = "Minimal"; //Module name $modversion['dirname'] = "minimal"; //Module path $modversion['hasMain'] = 1; //Module has a link in the main menu ?>
Save it and install the module. Done! Your main menu should now have a link to Minimal, and when you click it you should see the words Hello World.
Problems so far? Yes, the module has no logo in the Module Administration page. This is easily solved:
- Create a folder "images" inside the minimal folder.
- Create the logo and place it inside the images folder.
- Include this line in your xoops_version.php file:
$modversion['image'] = "/images/logo.png"; // logo (shown in admin)
... assuming you named the file logo.png. You'll have to update your module in the Module Administration before you can see the changes.
Now what?
Back to DevWiki Tutorials











![[Main Page]](/modules/mediawiki/images/mediawiki.png)


