<HTML ><HEAD ><TITLE >Creating modules</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP-Nuke: Management and Programming" HREF="book1.htm"><LINK REL="PREVIOUS" TITLE="How to create a new block" HREF="x1801.htm"><LINK REL="NEXT" TITLE="Creating fully compatible modules: the rules to follow" HREF="x1877.htm"></HEAD ><BODY CLASS="CHAPTER" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP-Nuke: Management and Programming</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="x1801.htm" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="x1877.htm" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="CHAPTER" ><H1 ><A NAME="CREATING-MODULES" ></A >Chapter 9. Creating modules</H1 ><DIV CLASS="TOC" ><DL ><DT ><B >Table of Contents</B ></DT ><DT ><A HREF="c1852.htm#MODULE-STRUCTURE" >Module structure</A ></DT ><DT ><A HREF="x1877.htm" >Creating fully compatible modules: the rules to follow</A ></DT ><DT ><A HREF="x1912.htm" >Module creation, the public part</A ></DT ><DT ><A HREF="x1986.htm" >Module creation, administrator part</A ></DT ></DL ></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="MODULE-STRUCTURE" ></A >Module structure</H1 ><P >The PHP-Nuke modules<A NAME="AEN1857" ></A > are PHP-written applications that manage the central part of the site. For example, the "News", "Forum", "Members List" etc. are all modules. Each module, based on it's complexity, is structured using one part for the user's and another for the administrator, in this case there are some contents we have to modify. It's all managed from the modules.php file which alone, carries out the job of authentication and management of the access rights on that module. The modules.php file checks and verifies if the module was activated or not, and verifies the access rights. This saves us a lot of work because we don't have to insert these controls in every module we create.</P ><P >We refer you to what is written in <A HREF="x1503.htm" >the Section called <I >Module management</I > in Chapter 6</A > to be more exhaustive.</P ><P >For example in the avantgo module, in order to load the index.php file, it's enough to pass the module name to the parameter string, the file that will be searched for is index.php.</P ><PRE CLASS="SCREEN" >modules.php?name=AvantGo</PRE ><P >If instead we wanted to call a page different from the default index.php (say, print.php), the string we will have to pass is :</P ><PRE CLASS="SCREEN" >modules.php?name=AvantGo & file=print</PRE ><P >That is the file variable with a value (print) that corresponds to the name of the file we want to load without the .php extension. </P ><P >Inside of the folder modules/nameofmodule there is also a subfolder called "language". In this fashion we manage in a simple and immediate way the multilanguage functionality inside the modules.</P ><P >The rows modules.php work in this way:</P ><P ></P ><UL ><LI ><P >It includes the mainfile.php</P ></LI ><LI ><P >Verifies if the module is active</P ></LI ><LI ><P >Verifies whether the string passes a file name different from index.php</P ></LI ><LI ><P >Verifies the permissions of the module (whether everybody can see it, or only registered users, or only the administrator).</P ></LI ></UL ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="x1801.htm" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="book1.htm" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="x1877.htm" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >How to create a new block</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" > </TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Creating fully compatible modules: the rules to follow</TD ></TR ></TABLE ></DIV ></BODY ></HTML >