<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.sandbox.joomla.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Cullenlinn</id>
	<title>Joomla! Documentation - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.sandbox.joomla.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Cullenlinn"/>
	<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/Special:Contributions/Cullenlinn"/>
	<updated>2026-06-05T04:42:05Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Rules_form_field_type&amp;diff=50981</id>
		<title>Rules form field type</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Rules_form_field_type&amp;diff=50981"/>
		<updated>2011-04-25T17:41:45Z</updated>

		<summary type="html">&lt;p&gt;Cullenlinn: Added in just the basic information for the control.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;rules&#039;&#039;&#039; parameter type provides a matrix of group by action options for managing access control.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;type&#039;&#039;&#039; (mandatory) must be &#039;&#039;rules&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;name&#039;&#039;&#039; (mandatory) is the unique name of the parameter.&lt;br /&gt;
* &#039;&#039;&#039;label&#039;&#039;&#039; (mandatory) (translatable) is the descriptive title of the field.&lt;br /&gt;
* &#039;&#039;&#039;description&#039;&#039;&#039; (optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.&lt;br /&gt;
* &#039;&#039;&#039;component&#039;&#039;&#039; (mandatory) indicates the component to which the action options will apply.&lt;br /&gt;
* &#039;&#039;&#039;section&#039;&#039;&#039; (mandatory) indicates the section of the access.xml actions the control should apply to. For example, &amp;quot;component&amp;quot; or &amp;quot;my_item_type&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== See also ===&lt;br /&gt;
* [[Standard form field types|Table of all standard form field types]]&lt;br /&gt;
[[Category:Standard form field types]]&lt;/div&gt;</summary>
		<author><name>Cullenlinn</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Talk:Creating_a_basic_Joomla!_template&amp;diff=15604</id>
		<title>Talk:Creating a basic Joomla! template</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Talk:Creating_a_basic_Joomla!_template&amp;diff=15604"/>
		<updated>2009-09-11T05:01:28Z</updated>

		<summary type="html">&lt;p&gt;Cullenlinn: /* Some Additional File Layout Notes */ new section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OK, something has gone wrong here. I edited the &amp;quot;creating an index.php file&amp;quot; and it went wrong - renamed itself 404.shtml. It refused to allow editing of the &amp;quot;creating&amp;quot; file so I tried making a new one &amp;quot;create&amp;quot;. Now I can&#039;t access either to edit them.&lt;br /&gt;
&lt;br /&gt;
Yeah, okay, I know why this is happening.  There is a mod_rewrite rule that looks for &amp;quot;index.php&amp;quot; and rewrites the URL in its SEF form.  This fails if &amp;quot;index.php&amp;quot; appears as part of the page name and so you get redirected to 404.shtml which is MediaWiki&#039;s &amp;quot;page not found&amp;quot; page.  I think the quick and easy fix is to simply avoid having &amp;quot;index.php&amp;quot; in page names.  [[User:Chris Davenport|Chris Davenport]] 10:29, 2 May 2008 (EDT)&lt;br /&gt;
&lt;br /&gt;
==A bit of craziness?==&lt;br /&gt;
What&#039;s happening toward the bottom of this page after &amp;quot;Finish it off - one last bit:&amp;quot;?  It seems like a bunch of code might have gotten accidentally pasted or something. [[User:Corsulian|Corsulian]] 14:36, 1 June 2008 (EDT)&lt;br /&gt;
:That &#039;&#039;bunch of code&#039;&#039; is the full template source explained in this tutorial and was included from &#039;&#039;another&#039;&#039; page but not wrapped in a PRE element to preserve the white space. I fixed all affected pages. --&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[[User:CirTap|CirTap]] &amp;lt;small&amp;gt;([[User talk:CirTap|talk]] • [[Special:Contributions/CirTap|contribs]])&amp;lt;/small&amp;gt;&amp;lt;/span&amp;gt; 10:23, 2 June 2008 (EDT)&lt;br /&gt;
&lt;br /&gt;
== How to edit ==&lt;br /&gt;
&lt;br /&gt;
I was going to make a basic proof reading change to the text, but all the edit screens do not show any text, only the headings between wouble curly brackets.  Is this because I am new, or because I am not too swift??&lt;br /&gt;
&lt;br /&gt;
Dave&lt;br /&gt;
&lt;br /&gt;
== How to edit ==&lt;br /&gt;
&lt;br /&gt;
I was going to make a basic proof reading change to the text, but all the edit screens do not show any text, only the headings between double curly brackets.  Is this because I am new, or because I am not too swift??&lt;br /&gt;
&lt;br /&gt;
Dave&lt;br /&gt;
&lt;br /&gt;
(sorry for the double post - veeerrry slow browser!)&lt;br /&gt;
&lt;br /&gt;
It&#039;s because you&#039;re new. ;-)  The titles in double curly brackets are links to &amp;quot;transcluded&amp;quot; pages; that is, other wiki pages that are being embedded in the page.  If you scroll to the bottom of the edit page you will see a list of the transcluded pages (they&#039;re called &amp;quot;templates&amp;quot; in wiki parlance; not to be confused with Joomla templates of course).  If you click on one of those links you will be taken to the page with the text on it.  From there you can click &amp;quot;Edit&amp;quot; and make your changes.  For more information about using the wiki see: [[Help:Contents]]. [[User:Chris Davenport|Chris Davenport]] 12:31, 21 August 2008 (EDT)&lt;br /&gt;
&lt;br /&gt;
Thanks Chris - thought it was something like that.&lt;br /&gt;
&lt;br /&gt;
== index.php header stylesheet ==&lt;br /&gt;
&lt;br /&gt;
I&#039;m new to Joomla! and still trying to get my head around the templates. Thanks to the author(s) so far on a clear and concise tutorial on a basic template.&lt;br /&gt;
&lt;br /&gt;
I was just wondering if the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; href=&amp;quot;&amp;lt;?php echo $this-&amp;gt;baseurl ?&amp;gt;/templates/&#039;&#039;&#039;mynewtemplate&#039;&#039;&#039;/css/style.css&amp;quot; type=&amp;quot;text/css&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
would not be better served as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; href=&amp;quot;&amp;lt;?php echo $this-&amp;gt;baseurl ?&amp;gt;templates/&#039;&#039;&#039;&amp;lt;?php echo $this-&amp;gt;template ?&amp;gt;&#039;&#039;&#039;/css/style.css&amp;quot; type=&amp;quot;text/css&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Regards&lt;br /&gt;
Pierre&lt;br /&gt;
&lt;br /&gt;
== Is doctype &amp;quot;transitional&amp;quot; really neccessary within joomla templates? ==&lt;br /&gt;
&lt;br /&gt;
Layout of modern templates usually try to use stricter definitions like &amp;quot;-//W3C//DTD HTML 4.01//EN&amp;quot; or even &amp;quot;-//W3C//DTD XHTML 1.1//EN&amp;quot;. I would prefer it, if developers try to succeed with these w3c recommendations.&lt;br /&gt;
&lt;br /&gt;
This is a user question, because i don&#039;t know the dependencies on joomla code&lt;br /&gt;
&lt;br /&gt;
regards gorgonz&lt;br /&gt;
&lt;br /&gt;
You can use whatever DocType you like in your template.  However, bear in mind that all your components and modules will also need to be Strict-compliant if you use Strict in your template.  You should only use Strict if you can guarantee that that will happen.  This includes &amp;quot;user-generated&amp;quot; content, so you need to be certain that the WYSIWYG editor is also outputting Strict code too.  It is for that reason that the core templates are set to the more conservative Transitional. [[User:Chris Davenport|Chris Davenport]] 17:30, 1 September 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
== $this-&amp;gt;baseurl ==&lt;br /&gt;
&lt;br /&gt;
Why is $this-&amp;gt;baseurl used when it is invalid and doesn&#039;t work in the context of index.php template files? From my understanding it should be JURI::root(). If you try and use $this-&amp;gt;baseurl in an index.php template file, you will find that nothing happens.&lt;br /&gt;
--[[User:Vcardillo|Vcardillo]] 17:24, 1 September 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
Looks like there was a code change and nobody noticed. ;-).  Would you like to help us out and amend the page appropriately?  Thanks.  [[User:Chris Davenport|Chris Davenport]] 17:32, 1 September 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
I might be wrong. I am reading through this thread: http://forum.joomla.org/viewtopic.php?f=231&amp;amp;t=230710 and trying to figure out whether $this-&amp;gt;baseurl should be used, or JURI::base() should be used. --[[User:Vcardillo|Vcardillo]] 17:41, 1 September 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
Okay, I delved into this a bit further.  $this-&amp;gt;baseurl is still valid and is equivalent to JURI::base( true ).  So the tutorial is correct as far as I can see.  You can find further information on JURI::base() here: [[JURI/base]].  You&#039;ll see I&#039;ve added a note on that page.  Thanks for pointing it out.  [[User:Chris Davenport|Chris Davenport]] 18:08, 1 September 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
I still don&#039;t think things are right. Sometimes the method returns a trailing slash, and sometimes it doesn&#039;t? Doesn&#039;t this make it impossible to properly code a template file? You never know if this method is going to end with a slash or not, so how can you properly and safely reference images or JS files? You could end up with a double slash.&lt;br /&gt;
--[[User:Vcardillo|Vcardillo]] 18:22, 1 September 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
I checked your corrections to [[JURI/base]] and they do seem to be correct.  Well done.  $this-&amp;gt;baseurl will behave consistently (ie. it will never add a trailing slash) because it is explicitly set to JURI::base(true).  You can see that in /libraries/joomla/application/component/view.php around line 178.  [[User:Chris Davenport|Chris Davenport]] 20:12, 1 September 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
Great. Thanks for the help and confirming! This all makes much more sense now. $this-&amp;gt;baseurl would seem to be the best practice. --[[User:Vcardillo|Vcardillo]] 22:22, 1 September 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Some Additional File Layout Notes ==&lt;br /&gt;
&lt;br /&gt;
Here are some more topics for inclusion:&lt;br /&gt;
&lt;br /&gt;
(1) Template style overrides for &amp;quot;component.php&amp;quot;, &amp;quot;error.php&amp;quot;, &amp;quot;offline.php&amp;quot;, and other custom templates for &amp;quot;tmpl&amp;quot; query parameters. By default:&lt;br /&gt;
- the error page (the &amp;quot;404 component not found&amp;quot; page) displays a default template located in /templates/system/error.php&lt;br /&gt;
- the component page (what displays when &amp;quot;tmpl=component&amp;quot; is supplied in the query string) displays a default template located in /templates/system/component.php&lt;br /&gt;
- the offline page (what displays when the site is set to &amp;quot;offline&amp;quot; in the global configuration) displays a default template located in /templates/system/offline.php&lt;br /&gt;
&lt;br /&gt;
Each of these can be overridden in a custom template by placing a file of the same name in the root of the individual&#039;s template directory. For example, to supply a custom error page for a template called &amp;quot;myfirsttemplate&amp;quot;, an error.php file would be placed in /templates/myfirsttemplate/error.php. Likewise, to supply a custom offline page, one would place an error template in /templates/myfirsttemplate/offline.php. In addition, any other type of template can be created to be displayed when the URL is formed with the &amp;quot;tmpl&amp;quot; query string parameter (e.g., http://mysite.com/index.php?tmpl=someothertemplate) by placing a template in the templates base directory with the same name - such as /templates/myfirsttemplate/someothertemplate.php.&lt;br /&gt;
&lt;br /&gt;
(2) Component and module overrides can be supplied for any component or module which makes use of Joomla! 1.5 mvc system&#039;s tmpl file (/components/com_mycomponent/views/someview/tmpl/default.php). To provide an alternate layout / template for a component, such as the contact (com_contact) component&#039;s contact detail view we can look at the component&#039;s natural front end layout (/components/com_contact/views/contact/tmpl/default.php) and create a file in the template directory at /templates/mytemplate/html/com_contact/contact/default.php which overrides the component&#039;s default.php file. This is really useful for creating custom views of components without changing the components themselves. A module&#039;s display can be modified in the same way, e.g., the /modules/mod_feed/tmpl/default.php file can be overridden by creating /templates/mytemplate/html/mod_feed/default.php.&lt;br /&gt;
&lt;br /&gt;
(3) Module styles can be added such that using &amp;lt;jdoc:include type=&amp;quot;modules&amp;quot; name=&amp;quot;module_position&amp;quot; style=&amp;quot;mynewstyle&amp;quot; /&amp;gt; would employ an alternate module content layout. For example, to create a new module style &amp;quot;mynewstyle&amp;quot; which displayed module content in a double bordered box we could create a new file /templates/mytemplate/html/modules.php with contents:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function modChrome_mynewstyle($module, &amp;amp;$params, &amp;amp;$attribs) {&lt;br /&gt;
   if (!empty($module-&amp;gt;content)) {&lt;br /&gt;
   ?&amp;gt;&lt;br /&gt;
   &amp;lt;div style=&amp;quot;border:1px solid #000;padding:3px;&amp;quot; class=&amp;quot;moduletable&amp;lt;?php echo $params-&amp;gt;get(&#039;moduleclass_sfx&#039;); ?&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;div style=&amp;quot;border:1px solid #000;padding:3px;&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;?php echo $module-&amp;gt;content; ?&amp;gt;&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
   &amp;lt;/div&amp;gt;&lt;br /&gt;
   &amp;lt;?php&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The formatting of the function name determine the style name (or visa versa). For example, for a new style &amp;quot;someotherstyle&amp;quot; the function would be named &amp;quot;function modChrome_someotherstyle(...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
--[[User:Cullenlinn|Cullen]] 05:01, 11 September 2009 (UTC)&lt;/div&gt;</summary>
		<author><name>Cullenlinn</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J1.5:Creating_a_simple_module&amp;diff=8429</id>
		<title>J1.5:Creating a simple module</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J1.5:Creating_a_simple_module&amp;diff=8429"/>
		<updated>2008-06-24T07:44:46Z</updated>

		<summary type="html">&lt;p&gt;Cullenlinn: This is the beginning of the article. It will still need some screen shots and possibly some better formatting.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
&lt;br /&gt;
== Basic Hello World Module ==&lt;br /&gt;
&lt;br /&gt;
A Joomla! 1.5 Module is in its most basic form two files: an XML configuration file and a PHP controller file. The XML configuration file contains general information about the module (as will be displayed in the Module Manager in the Joomla! administration interface), as well as module parameters which may be supplied to fine tune the appearance / functionality of the module. The PHP file provides the controlling logic for the module. A very simple &amp;quot;Hello World&amp;quot; module might looking something like this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/modules/mod_hello_world/mod_hello_world.xml:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;install type=&amp;quot;module&amp;quot; version=&amp;quot;1.5.0&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Name of the Module --&amp;gt;&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World - Hello&amp;lt;/name&amp;gt; &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- Name of the Author --&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;Ambitionality Software LLC&amp;lt;/author&amp;gt; &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- Version Date of the Module --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;2008-06-23&amp;lt;/creationDate&amp;gt; &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- Copyright information --&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;All rights reserved by Ambitionality Software LLC 2008.&amp;lt;/copyright&amp;gt; &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- License Information --&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;GPL 2.0&amp;lt;/license&amp;gt; &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- Author&#039;s email address --&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;info@ambitionality.com&amp;lt;/authorEmail&amp;gt; &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- Author&#039;s website --&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;www.ambitionality.com&amp;lt;/authorUrl&amp;gt; &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- Module version number --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;1.0.0&amp;lt;/version&amp;gt; &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- Description of what the module does --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Provides a basic &amp;quot;Hello World&amp;quot; notice&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- Listing of all files that should be installed for the module to function --&amp;gt;&lt;br /&gt;
	&amp;lt;files&amp;gt;&lt;br /&gt;
        &amp;lt;!-- The &amp;quot;module&amp;quot; attribute signifies that this is the main controller file --&amp;gt;&lt;br /&gt;
		&amp;lt;filename module=&amp;quot;mod_hello_world&amp;quot;&amp;gt;mod_hello_world.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- Optional parameters --&amp;gt;&lt;br /&gt;
	&amp;lt;params /&amp;gt;&lt;br /&gt;
&amp;lt;/install&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Basically, this XML file just lines out basic information about the module such as the owner, version, etc. for identification by the Joomla! installer and then provides optional parameters which may be set in the Module Manager and accessed from within the module&#039;s logic to fine tune it&#039;s behavior. Additionally, this file tells the installer which files should be copied installed. Notice that we DO NOT include a references in the files section for the XML file.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/modules/mod_hello_world/mod_hello_world.php:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
//don&#039;t allow other scripts to grab and execute our file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Direct Access to this location is not allowed.&#039;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
    Hello World&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What happens when this module is loaded is that Joomla! includes (via the PHP include directive) the mod_hello_world.php file and stores the output into an output buffer which is then rendered onto the page output. This file would simply produce &amp;lt;p&amp;gt;Hello World&amp;lt;/p&amp;gt; to the final page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/modules/mod_hello_world/index.html:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&amp;lt;body bgcolor=&amp;quot;#FFFFFF&amp;quot;&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This really just helps to ensure that a default page is displayed if direct access to the directory is attempted without listing all of the other files in the directory. It&#039;s not necessary, but is good practice.&lt;br /&gt;
&lt;br /&gt;
To package this module for distribution and installation, simply zip the files together, e.g.,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
% cd mod_hello_world&lt;br /&gt;
% zip mod_hello_world.zip mod_hello_world.php mod_hello_world.xml index.html&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The resulting mod_hello_world.zip file may be uploaded and installed through the standard Joomla! 1.5 Extension Manager.&lt;br /&gt;
&lt;br /&gt;
== Real Joomla! 1.5 Style Module Implementation ==&lt;br /&gt;
&lt;br /&gt;
Now that was easy...too easy. In fact, that was pretty much the simplest form of a module possible. In reality a module will probably be doing something much more substantial. Let&#039;s assume that our modules are going to be more complex - we need to take advantage of the MVC (Model View Controller) design pattern and consider using the following file layout for a &amp;quot;Hello World 2&amp;quot; module instead:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
/modules/mod_hello_world2/index.html&lt;br /&gt;
/modules/mod_hello_world2/mod_hello_world2.php&lt;br /&gt;
/modules/mod_hello_world2/mod_hello_world2.xml&lt;br /&gt;
/modules/mod_hello_world2/helper.php&lt;br /&gt;
/modules/mod_hello_world2/en-GB.mod_hello_world2.ini&lt;br /&gt;
/modules/mod_hello_world2/tmpl/index.html&lt;br /&gt;
/modules/mod_hello_world2/tmpl/default.php&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The differences to note here are that there are three additional files beyond what the &amp;quot;Hello World&amp;quot; module had, namely helper.php, tmpl/default.php, and the en-GB.mod_hello_world2.ini file. The purpose in adding the first two files is two-fold. Firstly, we separate the module&#039;s logic into the helper.php file to ensure that all of the thinking and data access is performed here and separate out the module&#039;s presentation / template into the tmpl/default.php file (the (X)HTML). I argue that this is just good programming - separating logic from presentation. There is a second advantage to this, however, which is that it will allow the HTML / presentation to be overridden easily by any Joomla! 1.5 template for optimal integration into any site. (Overriding module and component presentation in templates is beyond the scope of this article, however it should be addressed as it&#039;s really useful).&lt;br /&gt;
&lt;br /&gt;
Let&#039;s take a look at what these files might look like and discuss what&#039;s going on.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/modules/mod_hello_world2/mod_hello_world2.php:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
//no direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Direct Access to this location is not allowed.&#039;);&lt;br /&gt;
&lt;br /&gt;
// include the helper file&lt;br /&gt;
require_once(dirname(__FILE__).DS.&#039;helper.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// get a parameter from the module&#039;s configuration&lt;br /&gt;
$userCount = $params-&amp;gt;get(&#039;usercount&#039;);&lt;br /&gt;
&lt;br /&gt;
// get the items to display from the helper&lt;br /&gt;
$items = ModHelloWorld2Helper::getItems($userCount);&lt;br /&gt;
&lt;br /&gt;
// include the template for display&lt;br /&gt;
require(JModuleHelper::getLayoutPath(&#039;mod_hello_world2&#039;));&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The important differences to note are that (1) we include a helper file which will be the work-horse of our logic and data access and (2) once we have our data, we just load a template which will use our data and render it as it sees fit.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/modules/mod_hello_world2/mod_hello_world2.xml&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;install type=&amp;quot;module&amp;quot; version=&amp;quot;1.5.0&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Name of the Module --&amp;gt;&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World 2 - Hello&amp;lt;/name&amp;gt; &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- Name of the Author --&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;Ambitionality Software LLC&amp;lt;/author&amp;gt; &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- Version Date of the Module --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;2008-06-23&amp;lt;/creationDate&amp;gt; &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- Copyright information --&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;All rights reserved by Ambitionality Software LLC 2008.&amp;lt;/copyright&amp;gt; &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- License Information --&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;GPL 2.0&amp;lt;/license&amp;gt; &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- Author&#039;s email address --&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;info@ambitionality.com&amp;lt;/authorEmail&amp;gt; &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- Author&#039;s website --&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;www.ambitionality.com&amp;lt;/authorUrl&amp;gt; &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- Module version number --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;1.0.0&amp;lt;/version&amp;gt; &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- Description of what the module does --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Provides a random listing of registered users&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- Listing of all files that should be installed for the module to function --&amp;gt;&lt;br /&gt;
	&amp;lt;files&amp;gt;&lt;br /&gt;
        &amp;lt;!-- The &amp;quot;module&amp;quot; attribute signifies that this is the main controller file --&amp;gt;&lt;br /&gt;
		&amp;lt;filename module=&amp;quot;mod_hello_world2&amp;quot;&amp;gt;mod_hello_world2.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;helper.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;tmpl/default.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;tmpl/index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;languages&amp;gt;&lt;br /&gt;
        &amp;lt;!-- Any language files included with the module --&amp;gt;&lt;br /&gt;
        &amp;lt;language tag=&amp;quot;en-GB&amp;quot;&amp;gt;en-GB.mod_hello_world2.ini&amp;lt;/language&amp;gt;&lt;br /&gt;
    &amp;lt;/languages&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- Optional parameters --&amp;gt;&lt;br /&gt;
	&amp;lt;params&amp;gt;&lt;br /&gt;
        &amp;lt;!-- parameter to allow placement of a module class suffix for the module table / xhtml display --&amp;gt;&lt;br /&gt;
		&amp;lt;param name=&amp;quot;moduleclass_sfx&amp;quot; type=&amp;quot;text&amp;quot; default=&amp;quot;&amp;quot; label=&amp;quot;Module Class Suffix&amp;quot; description=&amp;quot;PARAMMODULECLASSSUFFIX&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;!-- just gives us a little room between the previous paramter and the next --&amp;gt;&lt;br /&gt;
		&amp;lt;param name=&amp;quot;@spacer&amp;quot; type=&amp;quot;spacer&amp;quot; default=&amp;quot;&amp;quot; label=&amp;quot;&amp;quot; description=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;!-- A parameter that allows an administrator to modify the number of users that this module will display --&amp;gt;&lt;br /&gt;
        &amp;lt;param name=&amp;quot;usercount&amp;quot; type=&amp;quot;text&amp;quot; default=&amp;quot;5&amp;quot; label=&amp;quot;LABEL USER COUNT&amp;quot; description=&amp;quot;DESC USER COUNT&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/params&amp;gt;&lt;br /&gt;
&amp;lt;/install&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main differences to note here are that we have added a language file reference (we could have added more) and we added some parameters.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/modules/mod_hello_world2/helper.php:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Direct Access to this location is not allowed.&#039;);&lt;br /&gt;
&lt;br /&gt;
class ModHelloWorld2Helper&lt;br /&gt;
{&lt;br /&gt;
    /**&lt;br /&gt;
     * Returns a list of post items&lt;br /&gt;
    */&lt;br /&gt;
    public function getItems($userCount)&lt;br /&gt;
    {&lt;br /&gt;
        // get a reference to the database&lt;br /&gt;
        $db = &amp;amp;JFactory::getDBO();&lt;br /&gt;
&lt;br /&gt;
        // get a list of all users&lt;br /&gt;
        $query = &#039;SELECT a.name&lt;br /&gt;
                  FROM `#__users` AS a&#039;&lt;br /&gt;
        ;&lt;br /&gt;
        $db-&amp;gt;setQuery($query);&lt;br /&gt;
        $items = ($items = $db-&amp;gt;loadObjectList())?$items:array();&lt;br /&gt;
&lt;br /&gt;
        // create a new array and fill it up with random users&lt;br /&gt;
        $actualCount = count($items);&lt;br /&gt;
        if ($actualCount &amp;lt; $userCount) {&lt;br /&gt;
            $userCount = $actualCount;&lt;br /&gt;
        }&lt;br /&gt;
        $items2 = array();&lt;br /&gt;
        $rands = array_rand($items, $userCount);&lt;br /&gt;
        foreach ($rands as $rand) {&lt;br /&gt;
            $items2[] = $items[$rand];&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        return $items2;&lt;br /&gt;
    } //end getItems&lt;br /&gt;
&lt;br /&gt;
} //end SimplestForumLatestPostsHelper&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This helper class (note that it is named for the module name so that it doesn&#039;t collide with other class names) simply retrieves a a list of all users in the database and randomly selects a subset of those based upon the number supplied as $userCount.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/modules/mod_hello_world2/tmpl/default.php:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;); // no direct access ?&amp;gt;&lt;br /&gt;
&amp;lt;?php echo JText::_(&#039;RANDOM USERS&#039;); ?&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
    &amp;lt;?php foreach ($items as $item) { ?&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;?php echo JText::sprintf(&#039;USER LABEL&#039;, $item-&amp;gt;name); ?&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here we simply create an unordered HTML list and then iterate through the items returned by our helper (in mod_hello_world2.php) printing out a message with each user&#039;s name.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/modules/mod_hello_world2/en-GB.mod_hello_world2.ini:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
LABEL USER COUNT=User Count&lt;br /&gt;
DESC USER COUNT=The number of users to display&lt;br /&gt;
RANDOM USERS=Random Users for Hello World2&lt;br /&gt;
USER LABEL=%s is a randomly selected user&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here we simply identify strings which appear in the module configuration file and the module template which appear in JText::_ or JText::sprintf statements. This allows someone to easily write a new language file without editing any of the HTML or code for the module.&lt;br /&gt;
&lt;br /&gt;
Now all we have to do is zip up these files, as in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
% pwd&lt;br /&gt;
/somesite/modules/mod_hello_world2&lt;br /&gt;
% zip -r ../mod_hello_world2.zip *&lt;br /&gt;
% ls ..&lt;br /&gt;
mod_hello_world2.zip&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The resulting mod_hello_world2.zip file is ready for installation and distribution. When the ZIP file is installed, the en-GB.mod_hello_world2.ini file is copied to /language/en-GB/en-GB.mod_hello_world2.ini and is loaded each time the module is loaded. All of the other files are copied to the /modules/mod_hello_world2 subfolder of the Joomla! installation.&lt;br /&gt;
&lt;br /&gt;
--03:44, 24 June 2008 (EDT)[[User:Cullenlinn|Cullenlinn]]&lt;/div&gt;</summary>
		<author><name>Cullenlinn</name></author>
	</entry>
</feed>