Get XOOPS XOOPSXOOPS FAQFAQ ForumsForums NewsNews ThemesThemes ModulesModules

Search

Donate to XOOPS!

Please select an amount to donate


Do you want your username revealed with your donation?
Yes - List me as a Generous Donor
No - List my donation as from an Anonymous Donor


Local Support

Advertisement

XOOPS Code hosted on SourceForge

Cumulus Tag Cloud

admin Arabic banner block Christmas comments cumulus DayDawn dhsoft e-Commerce E-Learning Git Google GUI hacks instant-zero jQuery module mygalleries news Nordic Olédrion oxygen PageRank PHP rmcommon security SEO simple-XOOPS Smarty sport tag Theme tutorial wiki WOX xoops XoopsEngine ZendFramework

New Users

Registering user

# 133948

guilhermeans

Welcome to XOOPS!
[Main Page]

Making a simple module: A minimal Xoops module

From XOOPS Web Application System

Main Page | Recent changes | Edit this page | Page history | Switch to MediaWiki mode

Printable version | Disclaimers | Privacy policy

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

Retrieved from "http://xoops.org/modules/mediawiki/index.php/Making_a_simple_module:_A_minimal_Xoops_module"

This page has been accessed 5,021 times. This page was last modified 17:30, 24 July 2009. Content is available under XOOPS Web Application System.