User Login    
 + Register
  • Main navigation
Login
Username:

Password:

Remember me



Lost Password?

Register now!
Who's Online
110 user(s) are online (8 user(s) are browsing XoopsWiki)

Members: 0
Guests: 110

more...
[Main Page]

A minimal Xoops module

From XOOPS Project

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

Printable version | Disclaimers | Privacy policy

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 «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: ModVersion

Create a file «xoops_version.php» inside your minimal folder. Let's start 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?

Retrieved from "http://www.xoops.org/modules/mediawiki/index.php/A_minimal_Xoops_module"

This page has been accessed 1,590 times. This page was last modified 11:19, 15 February 2008. Content is available under XOOPS Project.


Developers for Hire
Developers for Hire
Local Support Sites
Make a donation
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


Powered by
XOOPS Code hosted on SourceForge

Powered by PHP

PHP 5

Powered by MySQL

Powered by Smarty

OSI certified

GPL

All content on this site is subject to the Creative Commons License
Top Tags
Theme (5) news (2) security (2) sport (1) Arabic (1) wiki (1) Christmas (1) jQuery (1) tag (1) module (1) SEO (1) comments (1)
Advertisement