<?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=Kissaki</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=Kissaki"/>
	<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/Special:Contributions/Kissaki"/>
	<updated>2026-05-24T02:46:37Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Coding_style_and_standards&amp;diff=66782</id>
		<title>Coding style and standards</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Coding_style_and_standards&amp;diff=66782"/>
		<updated>2012-04-21T23:44:28Z</updated>

		<summary type="html">&lt;p&gt;Kissaki: /* Language Keys */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{RightTOC}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #ffc; border: 2px solid orange; padding: 0.5em;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- This needs some more emphasis =;) --&amp;gt;&lt;br /&gt;
==New Coding Standards Apply as of December 2011==&lt;br /&gt;
&#039;&#039;As of December 2011, this document has been replaced by newer [http://developer.joomla.org/coding-standards.html coding standards on the Joomla Developer Network]. Please use that document for the current versions of Joomla and the Joomla Platform. The older document is kept here for historical reference.&#039;&#039;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Good coding standards are important in any development project, but particularly when multiple developers are working on the same project. Having coding standards helps ensure that the code is of high quality, has fewer bugs, and is easily maintained.&lt;br /&gt;
&lt;br /&gt;
First rule, if in doubt, ask. There is [[Joomla_CodeSniffer|a tool available]] to help your code conform to the standards.&lt;br /&gt;
&lt;br /&gt;
== File Format ==&lt;br /&gt;
All files contributed to Joomla must:&lt;br /&gt;
&lt;br /&gt;
* Be stored as ASCII text&lt;br /&gt;
* Use UTF-8 character encoding&lt;br /&gt;
* Be Unix formatted&lt;br /&gt;
*:Lines must end only with a line feed (LF). Line feeds are represented as ordinal 10, octal 012 and hex 0A. Do not use carriage returns (CR) like Macintosh computers do or the carriage return/line feed combination (CRLF) like Windows computers do.&lt;br /&gt;
&lt;br /&gt;
New files will normally be added to the code base using Subversion (SVN). All SVN files should have the SVN property set &amp;quot;eol-style=LF&amp;quot;. Also, most Joomla! files will have &amp;quot;$Id&amp;quot; tags in the &amp;quot;@version&amp;quot; line of the Doc block. These require the SVN property &amp;quot;keywords=Id&amp;quot;. See [[Subversion File Properties]] for more information about how to set SVN properties.&lt;br /&gt;
&lt;br /&gt;
== Coding Standards ==&lt;br /&gt;
&lt;br /&gt;
=== Spelling ===&lt;br /&gt;
&lt;br /&gt;
Spelling of class, function, variable and constant names should generally be in accordance with British English rules (en_GB).  However, some exceptions are permitted, for example where common programming names are used that align with the PHP API such as &amp;lt;code&amp;gt;$color&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== E_STRICT-compatible code ===&lt;br /&gt;
&lt;br /&gt;
As of version 1.6, all new code that is suggested for inclusion into Joomla must be E_STRICT-compatible. This means that it must not produce any warnings or errors when PHP&#039;s error reporting level is set to E_ALL | E_STRICT.&lt;br /&gt;
&lt;br /&gt;
=== Indenting and Line Length ===&lt;br /&gt;
&lt;br /&gt;
Use tabs to indent, not spaces. Make sure that the tab-stops are set to only 4 spaces in length.&lt;br /&gt;
&lt;br /&gt;
There is no set limit for line length.  Use your judgment based on the nature of the line and readability.&lt;br /&gt;
&lt;br /&gt;
=== Control Structures ===&lt;br /&gt;
&lt;br /&gt;
These include if, for, while, switch, etc. Here is an example of an if statement, as it is the most complicated of the control structures:&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;
if ((condition1) || (condition2)) {&lt;br /&gt;
    action1();&lt;br /&gt;
} else if ((condition3) &amp;amp;&amp;amp; (condition4)) {&lt;br /&gt;
    action2();&lt;br /&gt;
} else {&lt;br /&gt;
    defaultAction();&lt;br /&gt;
    anotherAction();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// optional formatting if it improves readability&lt;br /&gt;
if ((condition1) || (condition2)) {&lt;br /&gt;
    action1();&lt;br /&gt;
} else if ((condition3) &amp;amp;&amp;amp; (condition4)) {&lt;br /&gt;
    action2();&lt;br /&gt;
} else {&lt;br /&gt;
    defaultAction();&lt;br /&gt;
    anotherAction();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Control statements should have one space between the control keyword and opening parenthesis, to distinguish them from function calls.&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;&#039;layouts&#039;&#039;&#039;, the alternative named notation should be used:&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;
if ((condition1) OR (condition2)) :&lt;br /&gt;
    action1();&lt;br /&gt;
elseif ((condition3) AND (condition4)) :&lt;br /&gt;
    action2();&lt;br /&gt;
else :&lt;br /&gt;
    defaultAction();&lt;br /&gt;
    anotherAction();&lt;br /&gt;
endif;&lt;br /&gt;
&lt;br /&gt;
foreach ($array as $element) :&lt;br /&gt;
    echo $element;&lt;br /&gt;
endforeach;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Logical operators in condition statements should use uppercase words (&amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt;, etc) rather than programmatic notation (&amp;lt;code&amp;gt;&amp;amp;&amp;amp;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;||&amp;lt;/code&amp;gt;, etc).&lt;br /&gt;
&lt;br /&gt;
With the exception of &amp;lt;code&amp;gt;case&amp;lt;/code&amp;gt; statements, curly braces must always be included even though they are technically optional. Having them increases readability and decreases the likelihood of logic errors being introduced when new lines are added.&lt;br /&gt;
&lt;br /&gt;
For switch statements:&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;
switch (condition) {&lt;br /&gt;
    case 1:&lt;br /&gt;
        doAction1();&lt;br /&gt;
        break;&lt;br /&gt;
    case 2:&lt;br /&gt;
        doAction2();&lt;br /&gt;
        break;&lt;br /&gt;
    default:&lt;br /&gt;
        doDefaultAction();&lt;br /&gt;
        break;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use indenting and line-breaks rather than curly braces in the &amp;lt;code&amp;gt;case&amp;lt;/code&amp;gt; statements to increase readability.  There should be no space between the condition and the colon in the &amp;lt;code&amp;gt;case&amp;lt;/code&amp;gt; statement.&lt;br /&gt;
&lt;br /&gt;
=== Function Calls ===&lt;br /&gt;
&lt;br /&gt;
Functions should be called with no spaces between the function name and the opening parenthesis, and no space between this and the first parameter; a space after the comma between each parameter (if they are present), and no space between the last parameter and the closing parenthesis, and the semicolon. Here&#039;s an example:&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;
$var = foo($bar, $baz, $quux);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As displayed above, there should be space before and one space after the equals sign used to assign the return value of a function to a variable. In the case of a block of related assignments, tabs (not spaces) may be inserted to promote readability:&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;
$short          = foo($bar);&lt;br /&gt;
$long_variable  = foo($baz);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Function Definitions ===&lt;br /&gt;
&lt;br /&gt;
Class and function declarations follow this convention:&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;
function fooFunction($arg1, $arg2 = &#039;&#039;)&lt;br /&gt;
{&lt;br /&gt;
    if (condition) {&lt;br /&gt;
        statement;&lt;br /&gt;
    }&lt;br /&gt;
    return $val;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class fooClass&lt;br /&gt;
{&lt;br /&gt;
    function fooMethod($arg1)&lt;br /&gt;
    {&lt;br /&gt;
        if ($arg) {&lt;br /&gt;
            $result = true;&lt;br /&gt;
        } else {&lt;br /&gt;
            $result = false;&lt;br /&gt;
        }&lt;br /&gt;
        return $result;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arguments with default values go at the end of the argument list. Always attempt to return a meaningful value from a function if one is appropriate. Here is a slightly longer example:&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;
function connect(&amp;amp;$dsn, $persistent = false)&lt;br /&gt;
{&lt;br /&gt;
    if (is_array($dsn)) {&lt;br /&gt;
        $dsninfo = &amp;amp;$dsn;&lt;br /&gt;
    } else {&lt;br /&gt;
        $dsninfo = DB::parseDSN($dsn);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if (!$dsninfo OR !$dsninfo[&#039;phptype&#039;]) {&lt;br /&gt;
        return $this-&amp;gt;raiseError();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return true;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Comments ===&lt;br /&gt;
&lt;br /&gt;
Inline documentation for classes should follow the PHPDoc convention, similar to Javadoc. More information about PHPDoc can be found on http://www.phpdoc.org/. There is a [[/Comments|standard for inline documentation comments]].&lt;br /&gt;
&lt;br /&gt;
Non-documentation comments are strongly encouraged. A general rule of thumb is that if you look at a section of code and think &amp;quot;Wow, I don&#039;t want to try and describe that&amp;quot;, you need to comment it before you forget how it works.&lt;br /&gt;
&lt;br /&gt;
C style comments (&amp;lt;tt&amp;gt;/* */&amp;lt;/tt&amp;gt;) and standard C++ comments (&amp;lt;tt&amp;gt;//&amp;lt;/tt&amp;gt;) are both satisfactory. Use of Perl/shell style comments (&amp;lt;tt&amp;gt;#&amp;lt;/tt&amp;gt;) is not permitted.&lt;br /&gt;
&lt;br /&gt;
Please note - &#039;&#039;&#039;code&#039;&#039;&#039; that has been &amp;quot;commented out&amp;quot; is not to be committed to trunk or release repositories.&lt;br /&gt;
&lt;br /&gt;
=== Including Code ===&lt;br /&gt;
&lt;br /&gt;
Anywhere you are unconditionally including a class file, use &amp;lt;code&amp;gt;require_once&amp;lt;/code&amp;gt;. Anywhere you are conditionally including a class file (for example, factory methods), use &amp;lt;code&amp;gt;include_once&amp;lt;/code&amp;gt;. Either of these will ensure that class files are included only once. They share the same file list, so you don&#039;t need to worry about mixing them -- a file included with &amp;lt;code&amp;gt;require_once&amp;lt;/code&amp;gt; will not be included again by &amp;lt;/code&amp;gt;include_once&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;Note: [[php:include_once|include_once]] and [[php:require_once|require_once]] are PHP &#039;&#039;language statements&#039;&#039;, not functions. You don&#039;t need parentheses around the filename to be included.&lt;br /&gt;
&lt;br /&gt;
=== PHP Code Tags ===&lt;br /&gt;
&lt;br /&gt;
Always use &amp;lt;tt&amp;gt;&amp;amp;lt;?php ?&amp;gt;&amp;lt;/tt&amp;gt; to delimit PHP code, not the &amp;lt;tt&amp;gt;&amp;amp;lt;? ?&amp;gt;&amp;lt;/tt&amp;gt; shorthand. This is the most portable way to include PHP code on differing operating systems and setups.&lt;br /&gt;
&lt;br /&gt;
For files that contain only PHP code, the closing tag (&amp;lt;tt&amp;gt;?&amp;gt;&amp;lt;/tt&amp;gt;) is never permitted. It is not required by PHP. Not including it prevents trailing white space from being accidentally injected into the output (see PHP manual on [http://au.php.net/basic-syntax.instruction-separation instruction separation]).&lt;br /&gt;
&lt;br /&gt;
=== SQL Queries ===&lt;br /&gt;
&lt;br /&gt;
SQL keywords are to be written in uppercase, while all other identifiers (which the exception of quoted text obviously) is to be in lowercase. Carriage returns should not be used as [[JDatabase]]::getQuery provides for formatted output.  However, indenting with spaces to improve readability is desireable.&lt;br /&gt;
&lt;br /&gt;
Queries should be wrapped in single quotes (as these text blocks are parsed faster by php).&lt;br /&gt;
&lt;br /&gt;
All quoted strings must use the &#039;&#039;Quote&#039;&#039; method to facilitate future compatibility with other database engines.&lt;br /&gt;
&lt;br /&gt;
All table names should use the &#039;&#039;&#039;&amp;lt;tt&amp;gt;#_&amp;lt;/tt&amp;gt;&#039;&#039;&#039; prefix rather than &amp;lt;tt&amp;gt;jos_&amp;lt;/tt&amp;gt; to access Joomla! contents and allow for the [[screen.config.15#Database_Settings|user defined database prefix]] to be applied.&lt;br /&gt;
&lt;br /&gt;
All expected integer or floating-point variable must be [http://php.net/manual/language.types.type-juggling.php cast] with &amp;lt;tt&amp;gt;(int)&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;(float)&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;(double)&amp;lt;/tt&amp;gt; as appropriate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
$state = 1;&lt;br /&gt;
$name  = &#039;bill&#039;;&lt;br /&gt;
$db    = &amp;amp;JFactory::getDBO();&lt;br /&gt;
$query = &#039;SELECT COUNT( c.id ) AS num_articles, u.id, u.username&#039;.&lt;br /&gt;
    &#039; FROM #__content AS c&#039;.&lt;br /&gt;
    &#039; LEFT JOIN #__users AS u ON u.id = c.created_by&#039;.&lt;br /&gt;
    &#039; WHERE c.state = &#039;.(int) $state&lt;br /&gt;
    &#039;  AND u.id IS NOT NULL&#039;.&lt;br /&gt;
    &#039;  AND u.username &amp;lt;&amp;gt; &#039;.$db-&amp;gt;Quote( $name ).&lt;br /&gt;
    &#039; GROUP BY u.id&#039;.&lt;br /&gt;
    &#039;  HAVING COUNT( c.id ) &amp;gt; 0&#039;;&lt;br /&gt;
$db-&amp;gt;setQuery();&lt;br /&gt;
// Output formated query if joomla debug is active:&lt;br /&gt;
if (JDEBUG) {&lt;br /&gt;
    echo $db-&amp;gt;getQuery();&lt;br /&gt;
}&lt;br /&gt;
$stats = $db-&amp;gt;loadObjectList();&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Doc Blocks ===&lt;br /&gt;
&lt;br /&gt;
All source code files in the core Joomla distribution must contain the following comment block as the header:&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;
/**&lt;br /&gt;
 * Short description of file&lt;br /&gt;
 *&lt;br /&gt;
 * Longer description of file is optional, but should be included if the file contains multiple classes or non-class material.&lt;br /&gt;
 *&lt;br /&gt;
 * PHP version 5.2.4 (put in the minimum version of PHP expected for the code here to run)&lt;br /&gt;
 *&lt;br /&gt;
 * @version	$Id$&lt;br /&gt;
 * @package	Joomla&lt;br /&gt;
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.&lt;br /&gt;
 * @license	GNU/GPL, see LICENSE.php&lt;br /&gt;
 */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;@package&amp;lt;/code&amp;gt; in the header is not required for class-only files.&lt;br /&gt;
&lt;br /&gt;
Classes, functions, constants, class properties and class methods should all be supplied with appropriate DocBlocks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Short description for class&lt;br /&gt;
 *&lt;br /&gt;
 * Long description for class (if any)...&lt;br /&gt;
 *&lt;br /&gt;
 * @package    PackageName&lt;br /&gt;
 * @subpackage SubPackageName&lt;br /&gt;
 * @link       http://pear.php.net/package/PackageName&lt;br /&gt;
 * @see        NetOther, Net_Sample::Net_Sample()&lt;br /&gt;
 * @since      Class available since Release 1.2.0&lt;br /&gt;
 * @deprecated Class deprecated in Release 2.0.0&lt;br /&gt;
 */&lt;br /&gt;
class JFooBar&lt;br /&gt;
{&lt;br /&gt;
    /**&lt;br /&gt;
     * @var int $id Primary key&lt;br /&gt;
     */&lt;br /&gt;
    public $id = null;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following package names are to be used in the core stack:&lt;br /&gt;
&lt;br /&gt;
* Joomla.Administrator - all files that belong only to the administrator or backend application&lt;br /&gt;
* Joomla.Installation - all files that belong to the installation application&lt;br /&gt;
* Joomla.Plugin - all plugin files&lt;br /&gt;
* Joomla.Site - all files that pertain only to the site or frontend application&lt;br /&gt;
* Joomla.XML-RPC - all files that belong to the XML-RPC server application&lt;br /&gt;
&lt;br /&gt;
The sub-package name will vary according to the extension type:&lt;br /&gt;
&lt;br /&gt;
* Components - the component folder, eg &amp;lt;code&amp;gt;com_content&amp;lt;/code&amp;gt;&lt;br /&gt;
* Modules - the module folder, eg &amp;lt;code&amp;gt;mod_latest_news&amp;lt;/code&amp;gt;&lt;br /&gt;
* Plugins - the folder.element, eg &amp;lt;code&amp;gt;content.pagebreak&amp;lt;/code&amp;gt;&lt;br /&gt;
* Templates - the template folder, eg &amp;lt;code&amp;gt;rhuk_milkyway&amp;lt;/code&amp;gt;&lt;br /&gt;
* Framework - nothing for top level files (such as &amp;lt;code&amp;gt;factory.php&amp;lt;/code&amp;gt;), the first level folder or the first.second level folders as appropriate, eg &amp;lt;code&amp;gt;utilities&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;joomla/utilities/date.php&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;html.html&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;joomla/html/html/email.php&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that code contributed to the Joomla stack that will become the copyright of the project is not allowed to include &amp;lt;code&amp;gt;@author&amp;lt;/code&amp;gt; tags.  You should update the contribution log in &amp;lt;tt&amp;gt;CREDITS.php&amp;lt;/tt&amp;gt;.  Joomla&#039;s philosophy is that the code is written &amp;quot;all together&amp;quot; and there is no notion of any one person &#039;owning&#039; any section of code.&lt;br /&gt;
&lt;br /&gt;
Files included from third party sources must leave DocBlocks intact. Layout files use the same DocBlocks as other PHP files. &lt;br /&gt;
&lt;br /&gt;
Note that the &amp;quot;@version $Id&amp;quot; line uses the SVN &amp;quot;keywords=Id&amp;quot; property. See [[Subversion File Properties]] for information about setting this property.&lt;br /&gt;
&lt;br /&gt;
== Naming Conventions ==&lt;br /&gt;
&lt;br /&gt;
=== Classes ===&lt;br /&gt;
&lt;br /&gt;
Classes should be given descriptive names. Avoid using abbreviations where possible. Class names should always begin with an uppercase letter and be written in CamelCase even if using traditionally uppercase acronyms (such as XML, HTML).  One exception is for Joomla framework classes which must begin with an uppercase &#039;J&#039; with the next letter also being uppercase.  For example:&lt;br /&gt;
&lt;br /&gt;
* JHtmlHelper&lt;br /&gt;
* JXmlParser&lt;br /&gt;
* JModel&lt;br /&gt;
&lt;br /&gt;
Third-party developers are advised to namespace their functions with a unique prefix.&lt;br /&gt;
&lt;br /&gt;
=== Functions and Methods ===&lt;br /&gt;
&lt;br /&gt;
Functions and methods should be named using the &amp;quot;studly caps&amp;quot; style (also referred to as &amp;quot;bumpy case&amp;quot; or &amp;quot;camel caps&amp;quot;). The initial letter of the name is lowercase, and each letter that starts a new &amp;quot;word&amp;quot; is capitalized. Function in the Joomla framework must begin with a lowercase &#039;j&#039;.  Some examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
connect();&lt;br /&gt;
getData();&lt;br /&gt;
buildSomeWidget();&lt;br /&gt;
jImport();&lt;br /&gt;
jDoSomething();&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Private class members (meaning class members that are intended to be used only from within the same class in which they are declared; are preceded by a single underscore. Properties are to be written in underscore format (that is, logical words separated by underscores) and should be all lowercase.  For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
class JFooBar&lt;br /&gt;
{&lt;br /&gt;
    // Joomla 1.5 and earlier format&lt;br /&gt;
    var $_status = null;&lt;br /&gt;
&lt;br /&gt;
    function _sort()&lt;br /&gt;
    {&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Joomla 1.6 format&lt;br /&gt;
    private $_status = null;&lt;br /&gt;
&lt;br /&gt;
    protected $field_name = null;&lt;br /&gt;
&lt;br /&gt;
    protected function _sort()&lt;br /&gt;
    {&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Constants ===&lt;br /&gt;
&lt;br /&gt;
Constants should always be all-uppercase, with underscores to separate words. Prefix constant names with the uppercase name of the class/package they are used in. For example, the constants used by the [[JError]] class all begin with &amp;quot;JERROR_&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Global Variables ===&lt;br /&gt;
&lt;br /&gt;
If your package needs to define global variables, their name should start with a single underscore followed by the uppercase class/package name and another underscore. For example, the JError class uses a global variable called $_JERROR_LEVELS.&lt;br /&gt;
&lt;br /&gt;
With PHP5 and later you may use static class properties or constants instead of globals.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
class JWhatever&lt;br /&gt;
{&lt;br /&gt;
    public static $instance = null;&lt;br /&gt;
    const SUCCESS = 1;&lt;br /&gt;
    const FAILURE = 0;&lt;br /&gt;
    // Methods...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Regular and Class Variables ===&lt;br /&gt;
&lt;br /&gt;
Regular variables, follow the same conventions as function.&lt;br /&gt;
&lt;br /&gt;
Class variables should be set to null or some other appropriate default value. Lining up the default values with tabs should only be used if particularly warranted for readability.&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
When using references, there should be a space before the reference operator and no space between it and the function or variable name.  For example:&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;
$ref1  = &amp;amp;$this-&amp;gt;_sql;&lt;br /&gt;
$db    = &amp;amp;JFactory::getDBO();&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Language Keys ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE: This part has to be rewritten for 1.6 (JM)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Except for the most common of words, such as &amp;quot;Yes&amp;quot;, &amp;quot;No&amp;quot;, &amp;quot;Show&amp;quot;, &amp;quot;Hide&amp;quot; &#039;&#039;&#039;all language keys should be namespaced&#039;&#039;&#039; to reflect the type of string they represent.  Always consider that if two extensions use the same key, the one loaded last will be the one that displays.&lt;br /&gt;
&lt;br /&gt;
Namespacing should generally relate to the extension displaying the text. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
echo JText::_(&#039;Weblink Link&#039;);&lt;br /&gt;
echo JText::_(&#039;Weblink Title&#039;);&lt;br /&gt;
echo JText::_(&#039;Weblink Description&#039;);&lt;br /&gt;
&lt;br /&gt;
echo JText::_(&#039;Exception An error occurred while saving&#039;);&lt;br /&gt;
?&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;TODO: Link to page with &amp;quot;common&amp;quot; strings that can be used for typical actions in components, such as &amp;quot;Save&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Where the same English word is used in two different locations, two different language keys should be used to allow for cases where the translation results in different words or phrases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
// A table column title&lt;br /&gt;
&amp;lt;th&amp;gt;&amp;lt;?php echo JText::_(&#039;Weblink Column Title&#039;);?&amp;gt;&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;&amp;lt;?php echo JText::_(&#039;Weblink Column Link&#039;);?&amp;gt;&amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// In the form&lt;br /&gt;
&amp;lt;?php echo JText::_(&#039;Weblink Title&#039;);?&amp;gt;&amp;lt;input name=&amp;quot;title&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;?php echo JText::_(&#039;Weblink Link&#039;);?&amp;gt;&amp;lt;input name=&amp;quot;link&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a further example: &#039;&#039;Toolbar&#039;&#039; and &#039;&#039;Linkbar text&#039;&#039; should be prefixed &#039;&#039;Toolbar&#039;&#039; and &#039;&#039;Linkbar&#039;&#039; respectively.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;language keys&#039;&#039;&#039; should be written &#039;&#039;&#039;as naturally as possible&#039;&#039;&#039; with spaces, not underscores separating words. Long phrases can be condensed to reduce keys to a sensible length. For example, tooltips for an edit field can be written like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php echo JText::_(&#039;Weblink Title&#039;);?&amp;gt;&amp;lt;input name=&amp;quot;title&amp;quot; title=&amp;quot;&amp;lt;?php echo JText::_(&#039;Weblink Title Desc&#039;);?&amp;gt;&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The convention used should be governed by &#039;&#039;&#039;common sense&#039;&#039;&#039;, but must be &#039;&#039;&#039;consistent&#039;&#039;&#039;. In general consider how the language file will look with all keys sorted alphabetically. Prefixes should be used to group text within a common context (such as column headings). Suffixes should be used to group elements that logically go together (such as a field name and its description).&lt;br /&gt;
&lt;br /&gt;
Phrases must never be assembled by string concatenation. Each &#039;&#039;&#039;phrase&#039;&#039;&#039; must be represented by a &#039;&#039;&#039;single language key&#039;&#039;&#039;, using &#039;&#039;&#039;sprintf as appropriate&#039;&#039;&#039; to replace dynamic words in the phrase. Where replacements are made, the word used should be as descriptive as possible and all-uppercase.  This assists the translators to determine the context of the replacement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
// Not permitted&lt;br /&gt;
echo JText::_(&#039;Deleted &#039;).$n.JText::_(&#039; items&#039;);&lt;br /&gt;
&lt;br /&gt;
// Permitted&lt;br /&gt;
echo JText::sprintf(&#039;Message Deleted NUMBER items&#039;, $n);&lt;br /&gt;
?&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reference in the language file would look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;MESSAGE DELETED NUMBER ITEMS=Deleted %d Item(s)&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;&#039;more than one dynamic string&#039;&#039;&#039; is used in a phrase, the printf markers should employ order placement as other languages might change the position of the strings. This is done via &#039;&#039;%[number]$[printf_type]&#039;&#039; as follows:&lt;br /&gt;
&lt;br /&gt;
Left to right language:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;PAGE X OF Y=Page %1$d of %2$d&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right to left language:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;PAGE X OF Y=%2$d of %1$d egaP&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Controllers ===&lt;br /&gt;
&lt;br /&gt;
For single controller components, the naming convention is &#039;&#039;[Name]Controller&#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;
/**&lt;br /&gt;
 * Content Controller&lt;br /&gt;
 * @package Joomla&lt;br /&gt;
 */&lt;br /&gt;
class ContentController extends JController&lt;br /&gt;
{&lt;br /&gt;
    // Methods&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The file name will generally be &#039;&#039;controller.php&#039;&#039; and is located in the component folder.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
com_content&lt;br /&gt;
 / controller.php&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a multi-controller components, such as the Banners in the Administrator, the convention is &#039;&#039;[Component]Controller[Name]&#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;
/**&lt;br /&gt;
 * Banner Client Controller&lt;br /&gt;
 * @package Joomla&lt;br /&gt;
 */&lt;br /&gt;
class BannerControllerClient extends JController&lt;br /&gt;
{&lt;br /&gt;
    // Methods&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The files will be located in a &amp;lt;tt&amp;gt;/controllers/&amp;lt;/tt&amp;gt; folder under the component folder.  The file names will reflect the name of the controller.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
com_banner&lt;br /&gt;
  /controllers/&lt;br /&gt;
    / banner.php&lt;br /&gt;
    / client.php&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Models===&lt;br /&gt;
&lt;br /&gt;
The naming convention is &#039;&#039;[Component]Model[Name]&#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;
/**&lt;br /&gt;
 * Banner Client Model&lt;br /&gt;
 * @package Joomla&lt;br /&gt;
 */&lt;br /&gt;
class BannerModelClient extends JModel&lt;br /&gt;
{&lt;br /&gt;
    // Methods&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The files will be located in a &amp;lt;tt&amp;gt;/models/&amp;lt;/tt&amp;gt; folder under the component folder.  The file names will reflect the name of the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
com_banner&lt;br /&gt;
  /models/&lt;br /&gt;
    / banner.php&lt;br /&gt;
    / client.php&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Views ===&lt;br /&gt;
The naming convention is &#039;&#039;[Component]View[Name]&#039;&#039;.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * Contact Category View&lt;br /&gt;
 * @package Joomla&lt;br /&gt;
 */&lt;br /&gt;
class ContactViewCategory extends JView&lt;br /&gt;
{&lt;br /&gt;
    // Methods&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The files will be located in a &amp;lt;tt&amp;gt;/view/&amp;lt;/tt&amp;gt; folder under the component folder. The subfolder names will reflect the name of a View.&lt;br /&gt;
&lt;br /&gt;
 com_contact&lt;br /&gt;
  /views/&lt;br /&gt;
    /&#039;&#039;view name 1&#039;&#039;/&lt;br /&gt;
      / view.html.php&lt;br /&gt;
    /&#039;&#039;view name 2&#039;&#039;/&lt;br /&gt;
      / view.html.php&lt;br /&gt;
&lt;br /&gt;
Multi-view components such as com_content may provide an optional &amp;quot;master&amp;quot; view class the specialised views extend from. It is located in the component folder and typically called &#039;&#039;view.php&#039;&#039;. The naming convention is &#039;&#039;[Component]View&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 com_content&lt;br /&gt;
  /views/&lt;br /&gt;
     &amp;lt;span style=&amp;quot;color:#999&amp;quot;&amp;gt;/archive/&amp;lt;/span&amp;gt;&lt;br /&gt;
       / view.html.php&lt;br /&gt;
     &amp;lt;span style=&amp;quot;color:#999&amp;quot;&amp;gt;/article/&amp;lt;/span&amp;gt;&lt;br /&gt;
  / view.php&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
view.php&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * Content View&lt;br /&gt;
 * @package Joomla&lt;br /&gt;
 */&lt;br /&gt;
class ContentView extends JView&lt;br /&gt;
{&lt;br /&gt;
    // Helper Methods&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
views/archive/view.html.php&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * Content Archive View&lt;br /&gt;
 * @package Joomla&lt;br /&gt;
 */&lt;br /&gt;
class ContactViewArchive extends ContentView&lt;br /&gt;
{&lt;br /&gt;
    // Methods&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plugins ===&lt;br /&gt;
&lt;br /&gt;
The naming convention is &#039;&#039;plg[Folder][Element]&#039;&#039; as pointed out in [[Creating a content plugin|the relevant tutorial]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
class plgContentPagebreak extends JPlugin&lt;br /&gt;
{&lt;br /&gt;
    // Methods&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Layouts ===&lt;br /&gt;
Components may support different Layouts to render the data supplied by a [[#Views|View]] and its [[#Models|Models]]. A Layout file usually contains markup and some PHP code for &#039;&#039;display logic only&#039;&#039;: no functions, no classes.&lt;br /&gt;
&lt;br /&gt;
A Layout consists of at least one .php file and an equally named [[Creating a basic layout.xml file|.xml manifest file]] located in the &amp;lt;tt&amp;gt;/tmpl/&amp;lt;/tt&amp;gt; folder of a View, both reflect the internal name of the Layout. The standard Layout is called &#039;&#039;default&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#999&amp;quot;&amp;gt;com_content&lt;br /&gt;
   /views/&lt;br /&gt;
     /article/&amp;lt;/span&amp;gt;&amp;lt;span style=&amp;quot;color:#000&amp;quot;&amp;gt;&lt;br /&gt;
       /tmpl/&lt;br /&gt;
         / default.php&lt;br /&gt;
         / default.xml&lt;br /&gt;
         / form.php&lt;br /&gt;
         / form.xml&lt;br /&gt;
         / pagebreak.php&lt;br /&gt;
         / pagebreak.xml &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Layout may use supplemental .php files to provide more granule control in order to render individual parts or repetitive items of the data.&lt;br /&gt;
&lt;br /&gt;
Users may customize the Layout output via [[#Template Layout Overrides|Template Layout Overrides]].&lt;br /&gt;
&lt;br /&gt;
=== Templates ===&lt;br /&gt;
&lt;br /&gt;
=== Template Layout Overrides ===&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Kissaki</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Coding_style_and_standards&amp;diff=66781</id>
		<title>Coding style and standards</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Coding_style_and_standards&amp;diff=66781"/>
		<updated>2012-04-21T23:44:00Z</updated>

		<summary type="html">&lt;p&gt;Kissaki: /* Language Keys */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{RightTOC}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #ffc; border: 2px solid orange; padding: 0.5em;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- This needs some more emphasis =;) --&amp;gt;&lt;br /&gt;
==New Coding Standards Apply as of December 2011==&lt;br /&gt;
&#039;&#039;As of December 2011, this document has been replaced by newer [http://developer.joomla.org/coding-standards.html coding standards on the Joomla Developer Network]. Please use that document for the current versions of Joomla and the Joomla Platform. The older document is kept here for historical reference.&#039;&#039;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Good coding standards are important in any development project, but particularly when multiple developers are working on the same project. Having coding standards helps ensure that the code is of high quality, has fewer bugs, and is easily maintained.&lt;br /&gt;
&lt;br /&gt;
First rule, if in doubt, ask. There is [[Joomla_CodeSniffer|a tool available]] to help your code conform to the standards.&lt;br /&gt;
&lt;br /&gt;
== File Format ==&lt;br /&gt;
All files contributed to Joomla must:&lt;br /&gt;
&lt;br /&gt;
* Be stored as ASCII text&lt;br /&gt;
* Use UTF-8 character encoding&lt;br /&gt;
* Be Unix formatted&lt;br /&gt;
*:Lines must end only with a line feed (LF). Line feeds are represented as ordinal 10, octal 012 and hex 0A. Do not use carriage returns (CR) like Macintosh computers do or the carriage return/line feed combination (CRLF) like Windows computers do.&lt;br /&gt;
&lt;br /&gt;
New files will normally be added to the code base using Subversion (SVN). All SVN files should have the SVN property set &amp;quot;eol-style=LF&amp;quot;. Also, most Joomla! files will have &amp;quot;$Id&amp;quot; tags in the &amp;quot;@version&amp;quot; line of the Doc block. These require the SVN property &amp;quot;keywords=Id&amp;quot;. See [[Subversion File Properties]] for more information about how to set SVN properties.&lt;br /&gt;
&lt;br /&gt;
== Coding Standards ==&lt;br /&gt;
&lt;br /&gt;
=== Spelling ===&lt;br /&gt;
&lt;br /&gt;
Spelling of class, function, variable and constant names should generally be in accordance with British English rules (en_GB).  However, some exceptions are permitted, for example where common programming names are used that align with the PHP API such as &amp;lt;code&amp;gt;$color&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== E_STRICT-compatible code ===&lt;br /&gt;
&lt;br /&gt;
As of version 1.6, all new code that is suggested for inclusion into Joomla must be E_STRICT-compatible. This means that it must not produce any warnings or errors when PHP&#039;s error reporting level is set to E_ALL | E_STRICT.&lt;br /&gt;
&lt;br /&gt;
=== Indenting and Line Length ===&lt;br /&gt;
&lt;br /&gt;
Use tabs to indent, not spaces. Make sure that the tab-stops are set to only 4 spaces in length.&lt;br /&gt;
&lt;br /&gt;
There is no set limit for line length.  Use your judgment based on the nature of the line and readability.&lt;br /&gt;
&lt;br /&gt;
=== Control Structures ===&lt;br /&gt;
&lt;br /&gt;
These include if, for, while, switch, etc. Here is an example of an if statement, as it is the most complicated of the control structures:&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;
if ((condition1) || (condition2)) {&lt;br /&gt;
    action1();&lt;br /&gt;
} else if ((condition3) &amp;amp;&amp;amp; (condition4)) {&lt;br /&gt;
    action2();&lt;br /&gt;
} else {&lt;br /&gt;
    defaultAction();&lt;br /&gt;
    anotherAction();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// optional formatting if it improves readability&lt;br /&gt;
if ((condition1) || (condition2)) {&lt;br /&gt;
    action1();&lt;br /&gt;
} else if ((condition3) &amp;amp;&amp;amp; (condition4)) {&lt;br /&gt;
    action2();&lt;br /&gt;
} else {&lt;br /&gt;
    defaultAction();&lt;br /&gt;
    anotherAction();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Control statements should have one space between the control keyword and opening parenthesis, to distinguish them from function calls.&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;&#039;layouts&#039;&#039;&#039;, the alternative named notation should be used:&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;
if ((condition1) OR (condition2)) :&lt;br /&gt;
    action1();&lt;br /&gt;
elseif ((condition3) AND (condition4)) :&lt;br /&gt;
    action2();&lt;br /&gt;
else :&lt;br /&gt;
    defaultAction();&lt;br /&gt;
    anotherAction();&lt;br /&gt;
endif;&lt;br /&gt;
&lt;br /&gt;
foreach ($array as $element) :&lt;br /&gt;
    echo $element;&lt;br /&gt;
endforeach;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Logical operators in condition statements should use uppercase words (&amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt;, etc) rather than programmatic notation (&amp;lt;code&amp;gt;&amp;amp;&amp;amp;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;||&amp;lt;/code&amp;gt;, etc).&lt;br /&gt;
&lt;br /&gt;
With the exception of &amp;lt;code&amp;gt;case&amp;lt;/code&amp;gt; statements, curly braces must always be included even though they are technically optional. Having them increases readability and decreases the likelihood of logic errors being introduced when new lines are added.&lt;br /&gt;
&lt;br /&gt;
For switch statements:&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;
switch (condition) {&lt;br /&gt;
    case 1:&lt;br /&gt;
        doAction1();&lt;br /&gt;
        break;&lt;br /&gt;
    case 2:&lt;br /&gt;
        doAction2();&lt;br /&gt;
        break;&lt;br /&gt;
    default:&lt;br /&gt;
        doDefaultAction();&lt;br /&gt;
        break;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use indenting and line-breaks rather than curly braces in the &amp;lt;code&amp;gt;case&amp;lt;/code&amp;gt; statements to increase readability.  There should be no space between the condition and the colon in the &amp;lt;code&amp;gt;case&amp;lt;/code&amp;gt; statement.&lt;br /&gt;
&lt;br /&gt;
=== Function Calls ===&lt;br /&gt;
&lt;br /&gt;
Functions should be called with no spaces between the function name and the opening parenthesis, and no space between this and the first parameter; a space after the comma between each parameter (if they are present), and no space between the last parameter and the closing parenthesis, and the semicolon. Here&#039;s an example:&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;
$var = foo($bar, $baz, $quux);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As displayed above, there should be space before and one space after the equals sign used to assign the return value of a function to a variable. In the case of a block of related assignments, tabs (not spaces) may be inserted to promote readability:&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;
$short          = foo($bar);&lt;br /&gt;
$long_variable  = foo($baz);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Function Definitions ===&lt;br /&gt;
&lt;br /&gt;
Class and function declarations follow this convention:&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;
function fooFunction($arg1, $arg2 = &#039;&#039;)&lt;br /&gt;
{&lt;br /&gt;
    if (condition) {&lt;br /&gt;
        statement;&lt;br /&gt;
    }&lt;br /&gt;
    return $val;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class fooClass&lt;br /&gt;
{&lt;br /&gt;
    function fooMethod($arg1)&lt;br /&gt;
    {&lt;br /&gt;
        if ($arg) {&lt;br /&gt;
            $result = true;&lt;br /&gt;
        } else {&lt;br /&gt;
            $result = false;&lt;br /&gt;
        }&lt;br /&gt;
        return $result;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arguments with default values go at the end of the argument list. Always attempt to return a meaningful value from a function if one is appropriate. Here is a slightly longer example:&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;
function connect(&amp;amp;$dsn, $persistent = false)&lt;br /&gt;
{&lt;br /&gt;
    if (is_array($dsn)) {&lt;br /&gt;
        $dsninfo = &amp;amp;$dsn;&lt;br /&gt;
    } else {&lt;br /&gt;
        $dsninfo = DB::parseDSN($dsn);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if (!$dsninfo OR !$dsninfo[&#039;phptype&#039;]) {&lt;br /&gt;
        return $this-&amp;gt;raiseError();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return true;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Comments ===&lt;br /&gt;
&lt;br /&gt;
Inline documentation for classes should follow the PHPDoc convention, similar to Javadoc. More information about PHPDoc can be found on http://www.phpdoc.org/. There is a [[/Comments|standard for inline documentation comments]].&lt;br /&gt;
&lt;br /&gt;
Non-documentation comments are strongly encouraged. A general rule of thumb is that if you look at a section of code and think &amp;quot;Wow, I don&#039;t want to try and describe that&amp;quot;, you need to comment it before you forget how it works.&lt;br /&gt;
&lt;br /&gt;
C style comments (&amp;lt;tt&amp;gt;/* */&amp;lt;/tt&amp;gt;) and standard C++ comments (&amp;lt;tt&amp;gt;//&amp;lt;/tt&amp;gt;) are both satisfactory. Use of Perl/shell style comments (&amp;lt;tt&amp;gt;#&amp;lt;/tt&amp;gt;) is not permitted.&lt;br /&gt;
&lt;br /&gt;
Please note - &#039;&#039;&#039;code&#039;&#039;&#039; that has been &amp;quot;commented out&amp;quot; is not to be committed to trunk or release repositories.&lt;br /&gt;
&lt;br /&gt;
=== Including Code ===&lt;br /&gt;
&lt;br /&gt;
Anywhere you are unconditionally including a class file, use &amp;lt;code&amp;gt;require_once&amp;lt;/code&amp;gt;. Anywhere you are conditionally including a class file (for example, factory methods), use &amp;lt;code&amp;gt;include_once&amp;lt;/code&amp;gt;. Either of these will ensure that class files are included only once. They share the same file list, so you don&#039;t need to worry about mixing them -- a file included with &amp;lt;code&amp;gt;require_once&amp;lt;/code&amp;gt; will not be included again by &amp;lt;/code&amp;gt;include_once&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;Note: [[php:include_once|include_once]] and [[php:require_once|require_once]] are PHP &#039;&#039;language statements&#039;&#039;, not functions. You don&#039;t need parentheses around the filename to be included.&lt;br /&gt;
&lt;br /&gt;
=== PHP Code Tags ===&lt;br /&gt;
&lt;br /&gt;
Always use &amp;lt;tt&amp;gt;&amp;amp;lt;?php ?&amp;gt;&amp;lt;/tt&amp;gt; to delimit PHP code, not the &amp;lt;tt&amp;gt;&amp;amp;lt;? ?&amp;gt;&amp;lt;/tt&amp;gt; shorthand. This is the most portable way to include PHP code on differing operating systems and setups.&lt;br /&gt;
&lt;br /&gt;
For files that contain only PHP code, the closing tag (&amp;lt;tt&amp;gt;?&amp;gt;&amp;lt;/tt&amp;gt;) is never permitted. It is not required by PHP. Not including it prevents trailing white space from being accidentally injected into the output (see PHP manual on [http://au.php.net/basic-syntax.instruction-separation instruction separation]).&lt;br /&gt;
&lt;br /&gt;
=== SQL Queries ===&lt;br /&gt;
&lt;br /&gt;
SQL keywords are to be written in uppercase, while all other identifiers (which the exception of quoted text obviously) is to be in lowercase. Carriage returns should not be used as [[JDatabase]]::getQuery provides for formatted output.  However, indenting with spaces to improve readability is desireable.&lt;br /&gt;
&lt;br /&gt;
Queries should be wrapped in single quotes (as these text blocks are parsed faster by php).&lt;br /&gt;
&lt;br /&gt;
All quoted strings must use the &#039;&#039;Quote&#039;&#039; method to facilitate future compatibility with other database engines.&lt;br /&gt;
&lt;br /&gt;
All table names should use the &#039;&#039;&#039;&amp;lt;tt&amp;gt;#_&amp;lt;/tt&amp;gt;&#039;&#039;&#039; prefix rather than &amp;lt;tt&amp;gt;jos_&amp;lt;/tt&amp;gt; to access Joomla! contents and allow for the [[screen.config.15#Database_Settings|user defined database prefix]] to be applied.&lt;br /&gt;
&lt;br /&gt;
All expected integer or floating-point variable must be [http://php.net/manual/language.types.type-juggling.php cast] with &amp;lt;tt&amp;gt;(int)&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;(float)&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;(double)&amp;lt;/tt&amp;gt; as appropriate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
$state = 1;&lt;br /&gt;
$name  = &#039;bill&#039;;&lt;br /&gt;
$db    = &amp;amp;JFactory::getDBO();&lt;br /&gt;
$query = &#039;SELECT COUNT( c.id ) AS num_articles, u.id, u.username&#039;.&lt;br /&gt;
    &#039; FROM #__content AS c&#039;.&lt;br /&gt;
    &#039; LEFT JOIN #__users AS u ON u.id = c.created_by&#039;.&lt;br /&gt;
    &#039; WHERE c.state = &#039;.(int) $state&lt;br /&gt;
    &#039;  AND u.id IS NOT NULL&#039;.&lt;br /&gt;
    &#039;  AND u.username &amp;lt;&amp;gt; &#039;.$db-&amp;gt;Quote( $name ).&lt;br /&gt;
    &#039; GROUP BY u.id&#039;.&lt;br /&gt;
    &#039;  HAVING COUNT( c.id ) &amp;gt; 0&#039;;&lt;br /&gt;
$db-&amp;gt;setQuery();&lt;br /&gt;
// Output formated query if joomla debug is active:&lt;br /&gt;
if (JDEBUG) {&lt;br /&gt;
    echo $db-&amp;gt;getQuery();&lt;br /&gt;
}&lt;br /&gt;
$stats = $db-&amp;gt;loadObjectList();&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Doc Blocks ===&lt;br /&gt;
&lt;br /&gt;
All source code files in the core Joomla distribution must contain the following comment block as the header:&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;
/**&lt;br /&gt;
 * Short description of file&lt;br /&gt;
 *&lt;br /&gt;
 * Longer description of file is optional, but should be included if the file contains multiple classes or non-class material.&lt;br /&gt;
 *&lt;br /&gt;
 * PHP version 5.2.4 (put in the minimum version of PHP expected for the code here to run)&lt;br /&gt;
 *&lt;br /&gt;
 * @version	$Id$&lt;br /&gt;
 * @package	Joomla&lt;br /&gt;
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.&lt;br /&gt;
 * @license	GNU/GPL, see LICENSE.php&lt;br /&gt;
 */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;@package&amp;lt;/code&amp;gt; in the header is not required for class-only files.&lt;br /&gt;
&lt;br /&gt;
Classes, functions, constants, class properties and class methods should all be supplied with appropriate DocBlocks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Short description for class&lt;br /&gt;
 *&lt;br /&gt;
 * Long description for class (if any)...&lt;br /&gt;
 *&lt;br /&gt;
 * @package    PackageName&lt;br /&gt;
 * @subpackage SubPackageName&lt;br /&gt;
 * @link       http://pear.php.net/package/PackageName&lt;br /&gt;
 * @see        NetOther, Net_Sample::Net_Sample()&lt;br /&gt;
 * @since      Class available since Release 1.2.0&lt;br /&gt;
 * @deprecated Class deprecated in Release 2.0.0&lt;br /&gt;
 */&lt;br /&gt;
class JFooBar&lt;br /&gt;
{&lt;br /&gt;
    /**&lt;br /&gt;
     * @var int $id Primary key&lt;br /&gt;
     */&lt;br /&gt;
    public $id = null;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following package names are to be used in the core stack:&lt;br /&gt;
&lt;br /&gt;
* Joomla.Administrator - all files that belong only to the administrator or backend application&lt;br /&gt;
* Joomla.Installation - all files that belong to the installation application&lt;br /&gt;
* Joomla.Plugin - all plugin files&lt;br /&gt;
* Joomla.Site - all files that pertain only to the site or frontend application&lt;br /&gt;
* Joomla.XML-RPC - all files that belong to the XML-RPC server application&lt;br /&gt;
&lt;br /&gt;
The sub-package name will vary according to the extension type:&lt;br /&gt;
&lt;br /&gt;
* Components - the component folder, eg &amp;lt;code&amp;gt;com_content&amp;lt;/code&amp;gt;&lt;br /&gt;
* Modules - the module folder, eg &amp;lt;code&amp;gt;mod_latest_news&amp;lt;/code&amp;gt;&lt;br /&gt;
* Plugins - the folder.element, eg &amp;lt;code&amp;gt;content.pagebreak&amp;lt;/code&amp;gt;&lt;br /&gt;
* Templates - the template folder, eg &amp;lt;code&amp;gt;rhuk_milkyway&amp;lt;/code&amp;gt;&lt;br /&gt;
* Framework - nothing for top level files (such as &amp;lt;code&amp;gt;factory.php&amp;lt;/code&amp;gt;), the first level folder or the first.second level folders as appropriate, eg &amp;lt;code&amp;gt;utilities&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;joomla/utilities/date.php&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;html.html&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;joomla/html/html/email.php&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that code contributed to the Joomla stack that will become the copyright of the project is not allowed to include &amp;lt;code&amp;gt;@author&amp;lt;/code&amp;gt; tags.  You should update the contribution log in &amp;lt;tt&amp;gt;CREDITS.php&amp;lt;/tt&amp;gt;.  Joomla&#039;s philosophy is that the code is written &amp;quot;all together&amp;quot; and there is no notion of any one person &#039;owning&#039; any section of code.&lt;br /&gt;
&lt;br /&gt;
Files included from third party sources must leave DocBlocks intact. Layout files use the same DocBlocks as other PHP files. &lt;br /&gt;
&lt;br /&gt;
Note that the &amp;quot;@version $Id&amp;quot; line uses the SVN &amp;quot;keywords=Id&amp;quot; property. See [[Subversion File Properties]] for information about setting this property.&lt;br /&gt;
&lt;br /&gt;
== Naming Conventions ==&lt;br /&gt;
&lt;br /&gt;
=== Classes ===&lt;br /&gt;
&lt;br /&gt;
Classes should be given descriptive names. Avoid using abbreviations where possible. Class names should always begin with an uppercase letter and be written in CamelCase even if using traditionally uppercase acronyms (such as XML, HTML).  One exception is for Joomla framework classes which must begin with an uppercase &#039;J&#039; with the next letter also being uppercase.  For example:&lt;br /&gt;
&lt;br /&gt;
* JHtmlHelper&lt;br /&gt;
* JXmlParser&lt;br /&gt;
* JModel&lt;br /&gt;
&lt;br /&gt;
Third-party developers are advised to namespace their functions with a unique prefix.&lt;br /&gt;
&lt;br /&gt;
=== Functions and Methods ===&lt;br /&gt;
&lt;br /&gt;
Functions and methods should be named using the &amp;quot;studly caps&amp;quot; style (also referred to as &amp;quot;bumpy case&amp;quot; or &amp;quot;camel caps&amp;quot;). The initial letter of the name is lowercase, and each letter that starts a new &amp;quot;word&amp;quot; is capitalized. Function in the Joomla framework must begin with a lowercase &#039;j&#039;.  Some examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
connect();&lt;br /&gt;
getData();&lt;br /&gt;
buildSomeWidget();&lt;br /&gt;
jImport();&lt;br /&gt;
jDoSomething();&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Private class members (meaning class members that are intended to be used only from within the same class in which they are declared; are preceded by a single underscore. Properties are to be written in underscore format (that is, logical words separated by underscores) and should be all lowercase.  For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
class JFooBar&lt;br /&gt;
{&lt;br /&gt;
    // Joomla 1.5 and earlier format&lt;br /&gt;
    var $_status = null;&lt;br /&gt;
&lt;br /&gt;
    function _sort()&lt;br /&gt;
    {&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Joomla 1.6 format&lt;br /&gt;
    private $_status = null;&lt;br /&gt;
&lt;br /&gt;
    protected $field_name = null;&lt;br /&gt;
&lt;br /&gt;
    protected function _sort()&lt;br /&gt;
    {&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Constants ===&lt;br /&gt;
&lt;br /&gt;
Constants should always be all-uppercase, with underscores to separate words. Prefix constant names with the uppercase name of the class/package they are used in. For example, the constants used by the [[JError]] class all begin with &amp;quot;JERROR_&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Global Variables ===&lt;br /&gt;
&lt;br /&gt;
If your package needs to define global variables, their name should start with a single underscore followed by the uppercase class/package name and another underscore. For example, the JError class uses a global variable called $_JERROR_LEVELS.&lt;br /&gt;
&lt;br /&gt;
With PHP5 and later you may use static class properties or constants instead of globals.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
class JWhatever&lt;br /&gt;
{&lt;br /&gt;
    public static $instance = null;&lt;br /&gt;
    const SUCCESS = 1;&lt;br /&gt;
    const FAILURE = 0;&lt;br /&gt;
    // Methods...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Regular and Class Variables ===&lt;br /&gt;
&lt;br /&gt;
Regular variables, follow the same conventions as function.&lt;br /&gt;
&lt;br /&gt;
Class variables should be set to null or some other appropriate default value. Lining up the default values with tabs should only be used if particularly warranted for readability.&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
When using references, there should be a space before the reference operator and no space between it and the function or variable name.  For example:&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;
$ref1  = &amp;amp;$this-&amp;gt;_sql;&lt;br /&gt;
$db    = &amp;amp;JFactory::getDBO();&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Language Keys ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE: This part has to be rewritten for 1.6 (JM)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Except for the most common of words, such as &amp;quot;Yes&amp;quot;, &amp;quot;No&amp;quot;, &amp;quot;Show&amp;quot;, &amp;quot;Hide&amp;quot; &#039;&#039;&#039;all language keys should be namespaced&#039;&#039;&#039; to reflect the type of string they represent.  Always consider that if two extensions use the same key, the one loaded last will be the one that displays.&lt;br /&gt;
&lt;br /&gt;
Namespacing should generally relate to the extension displaying the text. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
echo JText::_(&#039;Weblink Link&#039;);&lt;br /&gt;
echo JText::_(&#039;Weblink Title&#039;);&lt;br /&gt;
echo JText::_(&#039;Weblink Description&#039;);&lt;br /&gt;
&lt;br /&gt;
echo JText::_(&#039;Exception An error occurred while saving&#039;);&lt;br /&gt;
?&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;TODO: Link to page with &amp;quot;common&amp;quot; strings that can be used for typical actions in components, such as &amp;quot;Save&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Where the same English word is used in two different locations, two different language keys should be used to allow for cases where the translation results in different words or phrases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
// A table column title&lt;br /&gt;
&amp;lt;th&amp;gt;&amp;lt;?php echo JText::_(&#039;Weblink Column Title&#039;);?&amp;gt;&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;&amp;lt;?php echo JText::_(&#039;Weblink Column Link&#039;);?&amp;gt;&amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// In the form&lt;br /&gt;
&amp;lt;?php echo JText::_(&#039;Weblink Title&#039;);?&amp;gt;&amp;lt;input name=&amp;quot;title&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;?php echo JText::_(&#039;Weblink Link&#039;);?&amp;gt;&amp;lt;input name=&amp;quot;link&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a further example: &#039;&#039;Toolbar&#039;&#039; and &#039;&#039;Linkbar text&#039;&#039; should be prefixed &#039;&#039;Toolbar&#039;&#039; and &#039;&#039;Linkbar&#039;&#039; respectively.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;language keys&#039;&#039;&#039; should be written &#039;&#039;&#039;as naturally as possible&#039;&#039;&#039; with spaces, not underscores separating words. Long phrases can be condensed to reduce keys to a sensible length. For example, tooltips for an edit field can be written like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php echo JText::_(&#039;Weblink Title&#039;);?&amp;gt;&amp;lt;input name=&amp;quot;title&amp;quot; title=&amp;quot;&amp;lt;?php echo JText::_(&#039;Weblink Title Desc&#039;);?&amp;gt;&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The convention used should be governed by &#039;&#039;&#039;common sense&#039;&#039;&#039;, but must be &#039;&#039;&#039;consistent&#039;&#039;&#039;. In general consider how the language file will look with all keys sorted alphabetically. Prefixes should be used to group text within a common context (such as column headings). Suffixes should be used to group elements that logically go together (such as a field name and its description).&lt;br /&gt;
&lt;br /&gt;
Phrases must never be assembled by string concatenation. Each &#039;&#039;&#039;phrase&#039;&#039;&#039; must be represented by a &#039;&#039;&#039;single language key&#039;&#039;&#039;, using &#039;&#039;&#039;sprintf as appropriate&#039;&#039;&#039; to replace dynamic words in the phrase. Where replacements are made, the word used should be as descriptive as possible and all-uppercase.  This assists the translators to determine the context of the replacement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
// Not permitted&lt;br /&gt;
echo JText::_(&#039;Deleted &#039;).$n.JText::_(&#039; items&#039;);&lt;br /&gt;
&lt;br /&gt;
// Permitted&lt;br /&gt;
echo JText::sprintf(&#039;Message Deleted NUMBER items&#039;, $n);&lt;br /&gt;
?&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reference in the language file would look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;MESSAGE DELETED NUMBER ITEMS=Deleted %d Item(s)&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If more than one dynamic string is used in a phrase, the printf markers should employ order placement as other languages might change the position of the strings. This is done via &#039;&#039;%[number]$[printf_type]&#039;&#039; as follows:&lt;br /&gt;
&lt;br /&gt;
Left to right language:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;PAGE X OF Y=Page %1$d of %2$d&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right to left language:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;PAGE X OF Y=%2$d of %1$d egaP&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Controllers ===&lt;br /&gt;
&lt;br /&gt;
For single controller components, the naming convention is &#039;&#039;[Name]Controller&#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;
/**&lt;br /&gt;
 * Content Controller&lt;br /&gt;
 * @package Joomla&lt;br /&gt;
 */&lt;br /&gt;
class ContentController extends JController&lt;br /&gt;
{&lt;br /&gt;
    // Methods&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The file name will generally be &#039;&#039;controller.php&#039;&#039; and is located in the component folder.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
com_content&lt;br /&gt;
 / controller.php&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a multi-controller components, such as the Banners in the Administrator, the convention is &#039;&#039;[Component]Controller[Name]&#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;
/**&lt;br /&gt;
 * Banner Client Controller&lt;br /&gt;
 * @package Joomla&lt;br /&gt;
 */&lt;br /&gt;
class BannerControllerClient extends JController&lt;br /&gt;
{&lt;br /&gt;
    // Methods&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The files will be located in a &amp;lt;tt&amp;gt;/controllers/&amp;lt;/tt&amp;gt; folder under the component folder.  The file names will reflect the name of the controller.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
com_banner&lt;br /&gt;
  /controllers/&lt;br /&gt;
    / banner.php&lt;br /&gt;
    / client.php&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Models===&lt;br /&gt;
&lt;br /&gt;
The naming convention is &#039;&#039;[Component]Model[Name]&#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;
/**&lt;br /&gt;
 * Banner Client Model&lt;br /&gt;
 * @package Joomla&lt;br /&gt;
 */&lt;br /&gt;
class BannerModelClient extends JModel&lt;br /&gt;
{&lt;br /&gt;
    // Methods&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The files will be located in a &amp;lt;tt&amp;gt;/models/&amp;lt;/tt&amp;gt; folder under the component folder.  The file names will reflect the name of the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
com_banner&lt;br /&gt;
  /models/&lt;br /&gt;
    / banner.php&lt;br /&gt;
    / client.php&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Views ===&lt;br /&gt;
The naming convention is &#039;&#039;[Component]View[Name]&#039;&#039;.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * Contact Category View&lt;br /&gt;
 * @package Joomla&lt;br /&gt;
 */&lt;br /&gt;
class ContactViewCategory extends JView&lt;br /&gt;
{&lt;br /&gt;
    // Methods&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The files will be located in a &amp;lt;tt&amp;gt;/view/&amp;lt;/tt&amp;gt; folder under the component folder. The subfolder names will reflect the name of a View.&lt;br /&gt;
&lt;br /&gt;
 com_contact&lt;br /&gt;
  /views/&lt;br /&gt;
    /&#039;&#039;view name 1&#039;&#039;/&lt;br /&gt;
      / view.html.php&lt;br /&gt;
    /&#039;&#039;view name 2&#039;&#039;/&lt;br /&gt;
      / view.html.php&lt;br /&gt;
&lt;br /&gt;
Multi-view components such as com_content may provide an optional &amp;quot;master&amp;quot; view class the specialised views extend from. It is located in the component folder and typically called &#039;&#039;view.php&#039;&#039;. The naming convention is &#039;&#039;[Component]View&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 com_content&lt;br /&gt;
  /views/&lt;br /&gt;
     &amp;lt;span style=&amp;quot;color:#999&amp;quot;&amp;gt;/archive/&amp;lt;/span&amp;gt;&lt;br /&gt;
       / view.html.php&lt;br /&gt;
     &amp;lt;span style=&amp;quot;color:#999&amp;quot;&amp;gt;/article/&amp;lt;/span&amp;gt;&lt;br /&gt;
  / view.php&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
view.php&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * Content View&lt;br /&gt;
 * @package Joomla&lt;br /&gt;
 */&lt;br /&gt;
class ContentView extends JView&lt;br /&gt;
{&lt;br /&gt;
    // Helper Methods&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
views/archive/view.html.php&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * Content Archive View&lt;br /&gt;
 * @package Joomla&lt;br /&gt;
 */&lt;br /&gt;
class ContactViewArchive extends ContentView&lt;br /&gt;
{&lt;br /&gt;
    // Methods&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plugins ===&lt;br /&gt;
&lt;br /&gt;
The naming convention is &#039;&#039;plg[Folder][Element]&#039;&#039; as pointed out in [[Creating a content plugin|the relevant tutorial]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
class plgContentPagebreak extends JPlugin&lt;br /&gt;
{&lt;br /&gt;
    // Methods&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Layouts ===&lt;br /&gt;
Components may support different Layouts to render the data supplied by a [[#Views|View]] and its [[#Models|Models]]. A Layout file usually contains markup and some PHP code for &#039;&#039;display logic only&#039;&#039;: no functions, no classes.&lt;br /&gt;
&lt;br /&gt;
A Layout consists of at least one .php file and an equally named [[Creating a basic layout.xml file|.xml manifest file]] located in the &amp;lt;tt&amp;gt;/tmpl/&amp;lt;/tt&amp;gt; folder of a View, both reflect the internal name of the Layout. The standard Layout is called &#039;&#039;default&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#999&amp;quot;&amp;gt;com_content&lt;br /&gt;
   /views/&lt;br /&gt;
     /article/&amp;lt;/span&amp;gt;&amp;lt;span style=&amp;quot;color:#000&amp;quot;&amp;gt;&lt;br /&gt;
       /tmpl/&lt;br /&gt;
         / default.php&lt;br /&gt;
         / default.xml&lt;br /&gt;
         / form.php&lt;br /&gt;
         / form.xml&lt;br /&gt;
         / pagebreak.php&lt;br /&gt;
         / pagebreak.xml &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Layout may use supplemental .php files to provide more granule control in order to render individual parts or repetitive items of the data.&lt;br /&gt;
&lt;br /&gt;
Users may customize the Layout output via [[#Template Layout Overrides|Template Layout Overrides]].&lt;br /&gt;
&lt;br /&gt;
=== Templates ===&lt;br /&gt;
&lt;br /&gt;
=== Template Layout Overrides ===&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Kissaki</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Coding_style_and_standards&amp;diff=66780</id>
		<title>Coding style and standards</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Coding_style_and_standards&amp;diff=66780"/>
		<updated>2012-04-21T23:40:08Z</updated>

		<summary type="html">&lt;p&gt;Kissaki: /* Language Keys */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{RightTOC}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #ffc; border: 2px solid orange; padding: 0.5em;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- This needs some more emphasis =;) --&amp;gt;&lt;br /&gt;
==New Coding Standards Apply as of December 2011==&lt;br /&gt;
&#039;&#039;As of December 2011, this document has been replaced by newer [http://developer.joomla.org/coding-standards.html coding standards on the Joomla Developer Network]. Please use that document for the current versions of Joomla and the Joomla Platform. The older document is kept here for historical reference.&#039;&#039;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Good coding standards are important in any development project, but particularly when multiple developers are working on the same project. Having coding standards helps ensure that the code is of high quality, has fewer bugs, and is easily maintained.&lt;br /&gt;
&lt;br /&gt;
First rule, if in doubt, ask. There is [[Joomla_CodeSniffer|a tool available]] to help your code conform to the standards.&lt;br /&gt;
&lt;br /&gt;
== File Format ==&lt;br /&gt;
All files contributed to Joomla must:&lt;br /&gt;
&lt;br /&gt;
* Be stored as ASCII text&lt;br /&gt;
* Use UTF-8 character encoding&lt;br /&gt;
* Be Unix formatted&lt;br /&gt;
*:Lines must end only with a line feed (LF). Line feeds are represented as ordinal 10, octal 012 and hex 0A. Do not use carriage returns (CR) like Macintosh computers do or the carriage return/line feed combination (CRLF) like Windows computers do.&lt;br /&gt;
&lt;br /&gt;
New files will normally be added to the code base using Subversion (SVN). All SVN files should have the SVN property set &amp;quot;eol-style=LF&amp;quot;. Also, most Joomla! files will have &amp;quot;$Id&amp;quot; tags in the &amp;quot;@version&amp;quot; line of the Doc block. These require the SVN property &amp;quot;keywords=Id&amp;quot;. See [[Subversion File Properties]] for more information about how to set SVN properties.&lt;br /&gt;
&lt;br /&gt;
== Coding Standards ==&lt;br /&gt;
&lt;br /&gt;
=== Spelling ===&lt;br /&gt;
&lt;br /&gt;
Spelling of class, function, variable and constant names should generally be in accordance with British English rules (en_GB).  However, some exceptions are permitted, for example where common programming names are used that align with the PHP API such as &amp;lt;code&amp;gt;$color&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== E_STRICT-compatible code ===&lt;br /&gt;
&lt;br /&gt;
As of version 1.6, all new code that is suggested for inclusion into Joomla must be E_STRICT-compatible. This means that it must not produce any warnings or errors when PHP&#039;s error reporting level is set to E_ALL | E_STRICT.&lt;br /&gt;
&lt;br /&gt;
=== Indenting and Line Length ===&lt;br /&gt;
&lt;br /&gt;
Use tabs to indent, not spaces. Make sure that the tab-stops are set to only 4 spaces in length.&lt;br /&gt;
&lt;br /&gt;
There is no set limit for line length.  Use your judgment based on the nature of the line and readability.&lt;br /&gt;
&lt;br /&gt;
=== Control Structures ===&lt;br /&gt;
&lt;br /&gt;
These include if, for, while, switch, etc. Here is an example of an if statement, as it is the most complicated of the control structures:&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;
if ((condition1) || (condition2)) {&lt;br /&gt;
    action1();&lt;br /&gt;
} else if ((condition3) &amp;amp;&amp;amp; (condition4)) {&lt;br /&gt;
    action2();&lt;br /&gt;
} else {&lt;br /&gt;
    defaultAction();&lt;br /&gt;
    anotherAction();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// optional formatting if it improves readability&lt;br /&gt;
if ((condition1) || (condition2)) {&lt;br /&gt;
    action1();&lt;br /&gt;
} else if ((condition3) &amp;amp;&amp;amp; (condition4)) {&lt;br /&gt;
    action2();&lt;br /&gt;
} else {&lt;br /&gt;
    defaultAction();&lt;br /&gt;
    anotherAction();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Control statements should have one space between the control keyword and opening parenthesis, to distinguish them from function calls.&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;&#039;layouts&#039;&#039;&#039;, the alternative named notation should be used:&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;
if ((condition1) OR (condition2)) :&lt;br /&gt;
    action1();&lt;br /&gt;
elseif ((condition3) AND (condition4)) :&lt;br /&gt;
    action2();&lt;br /&gt;
else :&lt;br /&gt;
    defaultAction();&lt;br /&gt;
    anotherAction();&lt;br /&gt;
endif;&lt;br /&gt;
&lt;br /&gt;
foreach ($array as $element) :&lt;br /&gt;
    echo $element;&lt;br /&gt;
endforeach;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Logical operators in condition statements should use uppercase words (&amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt;, etc) rather than programmatic notation (&amp;lt;code&amp;gt;&amp;amp;&amp;amp;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;||&amp;lt;/code&amp;gt;, etc).&lt;br /&gt;
&lt;br /&gt;
With the exception of &amp;lt;code&amp;gt;case&amp;lt;/code&amp;gt; statements, curly braces must always be included even though they are technically optional. Having them increases readability and decreases the likelihood of logic errors being introduced when new lines are added.&lt;br /&gt;
&lt;br /&gt;
For switch statements:&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;
switch (condition) {&lt;br /&gt;
    case 1:&lt;br /&gt;
        doAction1();&lt;br /&gt;
        break;&lt;br /&gt;
    case 2:&lt;br /&gt;
        doAction2();&lt;br /&gt;
        break;&lt;br /&gt;
    default:&lt;br /&gt;
        doDefaultAction();&lt;br /&gt;
        break;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use indenting and line-breaks rather than curly braces in the &amp;lt;code&amp;gt;case&amp;lt;/code&amp;gt; statements to increase readability.  There should be no space between the condition and the colon in the &amp;lt;code&amp;gt;case&amp;lt;/code&amp;gt; statement.&lt;br /&gt;
&lt;br /&gt;
=== Function Calls ===&lt;br /&gt;
&lt;br /&gt;
Functions should be called with no spaces between the function name and the opening parenthesis, and no space between this and the first parameter; a space after the comma between each parameter (if they are present), and no space between the last parameter and the closing parenthesis, and the semicolon. Here&#039;s an example:&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;
$var = foo($bar, $baz, $quux);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As displayed above, there should be space before and one space after the equals sign used to assign the return value of a function to a variable. In the case of a block of related assignments, tabs (not spaces) may be inserted to promote readability:&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;
$short          = foo($bar);&lt;br /&gt;
$long_variable  = foo($baz);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Function Definitions ===&lt;br /&gt;
&lt;br /&gt;
Class and function declarations follow this convention:&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;
function fooFunction($arg1, $arg2 = &#039;&#039;)&lt;br /&gt;
{&lt;br /&gt;
    if (condition) {&lt;br /&gt;
        statement;&lt;br /&gt;
    }&lt;br /&gt;
    return $val;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class fooClass&lt;br /&gt;
{&lt;br /&gt;
    function fooMethod($arg1)&lt;br /&gt;
    {&lt;br /&gt;
        if ($arg) {&lt;br /&gt;
            $result = true;&lt;br /&gt;
        } else {&lt;br /&gt;
            $result = false;&lt;br /&gt;
        }&lt;br /&gt;
        return $result;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arguments with default values go at the end of the argument list. Always attempt to return a meaningful value from a function if one is appropriate. Here is a slightly longer example:&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;
function connect(&amp;amp;$dsn, $persistent = false)&lt;br /&gt;
{&lt;br /&gt;
    if (is_array($dsn)) {&lt;br /&gt;
        $dsninfo = &amp;amp;$dsn;&lt;br /&gt;
    } else {&lt;br /&gt;
        $dsninfo = DB::parseDSN($dsn);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if (!$dsninfo OR !$dsninfo[&#039;phptype&#039;]) {&lt;br /&gt;
        return $this-&amp;gt;raiseError();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return true;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Comments ===&lt;br /&gt;
&lt;br /&gt;
Inline documentation for classes should follow the PHPDoc convention, similar to Javadoc. More information about PHPDoc can be found on http://www.phpdoc.org/. There is a [[/Comments|standard for inline documentation comments]].&lt;br /&gt;
&lt;br /&gt;
Non-documentation comments are strongly encouraged. A general rule of thumb is that if you look at a section of code and think &amp;quot;Wow, I don&#039;t want to try and describe that&amp;quot;, you need to comment it before you forget how it works.&lt;br /&gt;
&lt;br /&gt;
C style comments (&amp;lt;tt&amp;gt;/* */&amp;lt;/tt&amp;gt;) and standard C++ comments (&amp;lt;tt&amp;gt;//&amp;lt;/tt&amp;gt;) are both satisfactory. Use of Perl/shell style comments (&amp;lt;tt&amp;gt;#&amp;lt;/tt&amp;gt;) is not permitted.&lt;br /&gt;
&lt;br /&gt;
Please note - &#039;&#039;&#039;code&#039;&#039;&#039; that has been &amp;quot;commented out&amp;quot; is not to be committed to trunk or release repositories.&lt;br /&gt;
&lt;br /&gt;
=== Including Code ===&lt;br /&gt;
&lt;br /&gt;
Anywhere you are unconditionally including a class file, use &amp;lt;code&amp;gt;require_once&amp;lt;/code&amp;gt;. Anywhere you are conditionally including a class file (for example, factory methods), use &amp;lt;code&amp;gt;include_once&amp;lt;/code&amp;gt;. Either of these will ensure that class files are included only once. They share the same file list, so you don&#039;t need to worry about mixing them -- a file included with &amp;lt;code&amp;gt;require_once&amp;lt;/code&amp;gt; will not be included again by &amp;lt;/code&amp;gt;include_once&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;Note: [[php:include_once|include_once]] and [[php:require_once|require_once]] are PHP &#039;&#039;language statements&#039;&#039;, not functions. You don&#039;t need parentheses around the filename to be included.&lt;br /&gt;
&lt;br /&gt;
=== PHP Code Tags ===&lt;br /&gt;
&lt;br /&gt;
Always use &amp;lt;tt&amp;gt;&amp;amp;lt;?php ?&amp;gt;&amp;lt;/tt&amp;gt; to delimit PHP code, not the &amp;lt;tt&amp;gt;&amp;amp;lt;? ?&amp;gt;&amp;lt;/tt&amp;gt; shorthand. This is the most portable way to include PHP code on differing operating systems and setups.&lt;br /&gt;
&lt;br /&gt;
For files that contain only PHP code, the closing tag (&amp;lt;tt&amp;gt;?&amp;gt;&amp;lt;/tt&amp;gt;) is never permitted. It is not required by PHP. Not including it prevents trailing white space from being accidentally injected into the output (see PHP manual on [http://au.php.net/basic-syntax.instruction-separation instruction separation]).&lt;br /&gt;
&lt;br /&gt;
=== SQL Queries ===&lt;br /&gt;
&lt;br /&gt;
SQL keywords are to be written in uppercase, while all other identifiers (which the exception of quoted text obviously) is to be in lowercase. Carriage returns should not be used as [[JDatabase]]::getQuery provides for formatted output.  However, indenting with spaces to improve readability is desireable.&lt;br /&gt;
&lt;br /&gt;
Queries should be wrapped in single quotes (as these text blocks are parsed faster by php).&lt;br /&gt;
&lt;br /&gt;
All quoted strings must use the &#039;&#039;Quote&#039;&#039; method to facilitate future compatibility with other database engines.&lt;br /&gt;
&lt;br /&gt;
All table names should use the &#039;&#039;&#039;&amp;lt;tt&amp;gt;#_&amp;lt;/tt&amp;gt;&#039;&#039;&#039; prefix rather than &amp;lt;tt&amp;gt;jos_&amp;lt;/tt&amp;gt; to access Joomla! contents and allow for the [[screen.config.15#Database_Settings|user defined database prefix]] to be applied.&lt;br /&gt;
&lt;br /&gt;
All expected integer or floating-point variable must be [http://php.net/manual/language.types.type-juggling.php cast] with &amp;lt;tt&amp;gt;(int)&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;(float)&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;(double)&amp;lt;/tt&amp;gt; as appropriate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
$state = 1;&lt;br /&gt;
$name  = &#039;bill&#039;;&lt;br /&gt;
$db    = &amp;amp;JFactory::getDBO();&lt;br /&gt;
$query = &#039;SELECT COUNT( c.id ) AS num_articles, u.id, u.username&#039;.&lt;br /&gt;
    &#039; FROM #__content AS c&#039;.&lt;br /&gt;
    &#039; LEFT JOIN #__users AS u ON u.id = c.created_by&#039;.&lt;br /&gt;
    &#039; WHERE c.state = &#039;.(int) $state&lt;br /&gt;
    &#039;  AND u.id IS NOT NULL&#039;.&lt;br /&gt;
    &#039;  AND u.username &amp;lt;&amp;gt; &#039;.$db-&amp;gt;Quote( $name ).&lt;br /&gt;
    &#039; GROUP BY u.id&#039;.&lt;br /&gt;
    &#039;  HAVING COUNT( c.id ) &amp;gt; 0&#039;;&lt;br /&gt;
$db-&amp;gt;setQuery();&lt;br /&gt;
// Output formated query if joomla debug is active:&lt;br /&gt;
if (JDEBUG) {&lt;br /&gt;
    echo $db-&amp;gt;getQuery();&lt;br /&gt;
}&lt;br /&gt;
$stats = $db-&amp;gt;loadObjectList();&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Doc Blocks ===&lt;br /&gt;
&lt;br /&gt;
All source code files in the core Joomla distribution must contain the following comment block as the header:&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;
/**&lt;br /&gt;
 * Short description of file&lt;br /&gt;
 *&lt;br /&gt;
 * Longer description of file is optional, but should be included if the file contains multiple classes or non-class material.&lt;br /&gt;
 *&lt;br /&gt;
 * PHP version 5.2.4 (put in the minimum version of PHP expected for the code here to run)&lt;br /&gt;
 *&lt;br /&gt;
 * @version	$Id$&lt;br /&gt;
 * @package	Joomla&lt;br /&gt;
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.&lt;br /&gt;
 * @license	GNU/GPL, see LICENSE.php&lt;br /&gt;
 */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;@package&amp;lt;/code&amp;gt; in the header is not required for class-only files.&lt;br /&gt;
&lt;br /&gt;
Classes, functions, constants, class properties and class methods should all be supplied with appropriate DocBlocks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Short description for class&lt;br /&gt;
 *&lt;br /&gt;
 * Long description for class (if any)...&lt;br /&gt;
 *&lt;br /&gt;
 * @package    PackageName&lt;br /&gt;
 * @subpackage SubPackageName&lt;br /&gt;
 * @link       http://pear.php.net/package/PackageName&lt;br /&gt;
 * @see        NetOther, Net_Sample::Net_Sample()&lt;br /&gt;
 * @since      Class available since Release 1.2.0&lt;br /&gt;
 * @deprecated Class deprecated in Release 2.0.0&lt;br /&gt;
 */&lt;br /&gt;
class JFooBar&lt;br /&gt;
{&lt;br /&gt;
    /**&lt;br /&gt;
     * @var int $id Primary key&lt;br /&gt;
     */&lt;br /&gt;
    public $id = null;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following package names are to be used in the core stack:&lt;br /&gt;
&lt;br /&gt;
* Joomla.Administrator - all files that belong only to the administrator or backend application&lt;br /&gt;
* Joomla.Installation - all files that belong to the installation application&lt;br /&gt;
* Joomla.Plugin - all plugin files&lt;br /&gt;
* Joomla.Site - all files that pertain only to the site or frontend application&lt;br /&gt;
* Joomla.XML-RPC - all files that belong to the XML-RPC server application&lt;br /&gt;
&lt;br /&gt;
The sub-package name will vary according to the extension type:&lt;br /&gt;
&lt;br /&gt;
* Components - the component folder, eg &amp;lt;code&amp;gt;com_content&amp;lt;/code&amp;gt;&lt;br /&gt;
* Modules - the module folder, eg &amp;lt;code&amp;gt;mod_latest_news&amp;lt;/code&amp;gt;&lt;br /&gt;
* Plugins - the folder.element, eg &amp;lt;code&amp;gt;content.pagebreak&amp;lt;/code&amp;gt;&lt;br /&gt;
* Templates - the template folder, eg &amp;lt;code&amp;gt;rhuk_milkyway&amp;lt;/code&amp;gt;&lt;br /&gt;
* Framework - nothing for top level files (such as &amp;lt;code&amp;gt;factory.php&amp;lt;/code&amp;gt;), the first level folder or the first.second level folders as appropriate, eg &amp;lt;code&amp;gt;utilities&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;joomla/utilities/date.php&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;html.html&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;joomla/html/html/email.php&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that code contributed to the Joomla stack that will become the copyright of the project is not allowed to include &amp;lt;code&amp;gt;@author&amp;lt;/code&amp;gt; tags.  You should update the contribution log in &amp;lt;tt&amp;gt;CREDITS.php&amp;lt;/tt&amp;gt;.  Joomla&#039;s philosophy is that the code is written &amp;quot;all together&amp;quot; and there is no notion of any one person &#039;owning&#039; any section of code.&lt;br /&gt;
&lt;br /&gt;
Files included from third party sources must leave DocBlocks intact. Layout files use the same DocBlocks as other PHP files. &lt;br /&gt;
&lt;br /&gt;
Note that the &amp;quot;@version $Id&amp;quot; line uses the SVN &amp;quot;keywords=Id&amp;quot; property. See [[Subversion File Properties]] for information about setting this property.&lt;br /&gt;
&lt;br /&gt;
== Naming Conventions ==&lt;br /&gt;
&lt;br /&gt;
=== Classes ===&lt;br /&gt;
&lt;br /&gt;
Classes should be given descriptive names. Avoid using abbreviations where possible. Class names should always begin with an uppercase letter and be written in CamelCase even if using traditionally uppercase acronyms (such as XML, HTML).  One exception is for Joomla framework classes which must begin with an uppercase &#039;J&#039; with the next letter also being uppercase.  For example:&lt;br /&gt;
&lt;br /&gt;
* JHtmlHelper&lt;br /&gt;
* JXmlParser&lt;br /&gt;
* JModel&lt;br /&gt;
&lt;br /&gt;
Third-party developers are advised to namespace their functions with a unique prefix.&lt;br /&gt;
&lt;br /&gt;
=== Functions and Methods ===&lt;br /&gt;
&lt;br /&gt;
Functions and methods should be named using the &amp;quot;studly caps&amp;quot; style (also referred to as &amp;quot;bumpy case&amp;quot; or &amp;quot;camel caps&amp;quot;). The initial letter of the name is lowercase, and each letter that starts a new &amp;quot;word&amp;quot; is capitalized. Function in the Joomla framework must begin with a lowercase &#039;j&#039;.  Some examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
connect();&lt;br /&gt;
getData();&lt;br /&gt;
buildSomeWidget();&lt;br /&gt;
jImport();&lt;br /&gt;
jDoSomething();&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Private class members (meaning class members that are intended to be used only from within the same class in which they are declared; are preceded by a single underscore. Properties are to be written in underscore format (that is, logical words separated by underscores) and should be all lowercase.  For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
class JFooBar&lt;br /&gt;
{&lt;br /&gt;
    // Joomla 1.5 and earlier format&lt;br /&gt;
    var $_status = null;&lt;br /&gt;
&lt;br /&gt;
    function _sort()&lt;br /&gt;
    {&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Joomla 1.6 format&lt;br /&gt;
    private $_status = null;&lt;br /&gt;
&lt;br /&gt;
    protected $field_name = null;&lt;br /&gt;
&lt;br /&gt;
    protected function _sort()&lt;br /&gt;
    {&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Constants ===&lt;br /&gt;
&lt;br /&gt;
Constants should always be all-uppercase, with underscores to separate words. Prefix constant names with the uppercase name of the class/package they are used in. For example, the constants used by the [[JError]] class all begin with &amp;quot;JERROR_&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Global Variables ===&lt;br /&gt;
&lt;br /&gt;
If your package needs to define global variables, their name should start with a single underscore followed by the uppercase class/package name and another underscore. For example, the JError class uses a global variable called $_JERROR_LEVELS.&lt;br /&gt;
&lt;br /&gt;
With PHP5 and later you may use static class properties or constants instead of globals.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
class JWhatever&lt;br /&gt;
{&lt;br /&gt;
    public static $instance = null;&lt;br /&gt;
    const SUCCESS = 1;&lt;br /&gt;
    const FAILURE = 0;&lt;br /&gt;
    // Methods...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Regular and Class Variables ===&lt;br /&gt;
&lt;br /&gt;
Regular variables, follow the same conventions as function.&lt;br /&gt;
&lt;br /&gt;
Class variables should be set to null or some other appropriate default value. Lining up the default values with tabs should only be used if particularly warranted for readability.&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
When using references, there should be a space before the reference operator and no space between it and the function or variable name.  For example:&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;
$ref1  = &amp;amp;$this-&amp;gt;_sql;&lt;br /&gt;
$db    = &amp;amp;JFactory::getDBO();&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Language Keys ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE: This part has to be rewritten for 1.6 (JM)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Except for the most common of words, such as &amp;quot;Yes&amp;quot;, &amp;quot;No&amp;quot;, &amp;quot;Show&amp;quot;, &amp;quot;Hide&amp;quot; &#039;&#039;&#039;all language keys should be namespaced&#039;&#039;&#039; to reflect the type of string they represent.  Always consider that if two extensions use the same key, the one loaded last will be the one that displays.&lt;br /&gt;
&lt;br /&gt;
Namespacing should generally relate to the extension displaying the text. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
echo JText::_(&#039;Weblink Link&#039;);&lt;br /&gt;
echo JText::_(&#039;Weblink Title&#039;);&lt;br /&gt;
echo JText::_(&#039;Weblink Description&#039;);&lt;br /&gt;
&lt;br /&gt;
echo JText::_(&#039;Exception An error occurred while saving&#039;);&lt;br /&gt;
?&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;TODO: Link to page with &amp;quot;common&amp;quot; strings that can be used for typical actions in components, such as &amp;quot;Save&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Where the same English word is used in two different locations, two different language keys should be used to allow for cases where the translation results in different words or phrases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
// A table column title&lt;br /&gt;
&amp;lt;th&amp;gt;&amp;lt;?php echo JText::_(&#039;Weblink Column Title&#039;);?&amp;gt;&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;&amp;lt;?php echo JText::_(&#039;Weblink Column Link&#039;);?&amp;gt;&amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// In the form&lt;br /&gt;
&amp;lt;?php echo JText::_(&#039;Weblink Title&#039;);?&amp;gt;&amp;lt;input name=&amp;quot;title&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;?php echo JText::_(&#039;Weblink Link&#039;);?&amp;gt;&amp;lt;input name=&amp;quot;link&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a further example: &#039;&#039;Toolbar&#039;&#039; and &#039;&#039;Linkbar text&#039;&#039; should be prefixed &#039;&#039;Toolbar&#039;&#039; and &#039;&#039;Linkbar&#039;&#039; respectively.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;language keys&#039;&#039;&#039; should be written &#039;&#039;&#039;as naturally as possible&#039;&#039;&#039; with spaces, not underscores separating words. Long phrases can be condensed to reduce keys to a sensible length. For example, tooltips for an edit field can be written like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php echo JText::_(&#039;Weblink Title&#039;);?&amp;gt;&amp;lt;input name=&amp;quot;title&amp;quot; title=&amp;quot;&amp;lt;?php echo JText::_(&#039;Weblink Title Desc&#039;);?&amp;gt;&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The convention used should be governed by &#039;&#039;&#039;common sense&#039;&#039;&#039;, but must be &#039;&#039;&#039;consistent&#039;&#039;&#039;. In general consider how the language file will look with all keys sorted alphabetically. Prefixes should be used to group text within a common context (such as column headings). Suffixes should be used to group elements that logically go together (such as a field name and its description).&lt;br /&gt;
&lt;br /&gt;
Phrases must never be assembled by string concatenation. Each &#039;&#039;&#039;phrase&#039;&#039;&#039; must be represented by a &#039;&#039;&#039;single language key&#039;&#039;&#039;, using &#039;&#039;&#039;sprintf as appropriate&#039;&#039;&#039; to replace dynamic words in the phrase. Where replacements are made, the word used should be as descriptive as possible and all-uppercase.  This assists the translators to determine the context of the replacement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
// Not permitted&lt;br /&gt;
echo JText::_(&#039;Deleted &#039;).$n.JText::_(&#039; items&#039;);&lt;br /&gt;
&lt;br /&gt;
// Permitted&lt;br /&gt;
echo JText::sprintf(&#039;Message Deleted NUMBER items&#039;, $n);&lt;br /&gt;
?&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reference in the language file would look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;MESSAGE DELETED NUMBER ITEMS=Deleted %d Item(s)&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If more than one dynamic string is used in a phrase, the printf markers should employ order placement as other languages might change the position of the strings. This is done via %[number]$[printf_type] as follows:&lt;br /&gt;
&lt;br /&gt;
Left to right language:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;PAGE X OF Y=Page %1$d of %2$d&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right to left language:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;PAGE X OF Y=%2$d of %1$d egaP&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Controllers ===&lt;br /&gt;
&lt;br /&gt;
For single controller components, the naming convention is &#039;&#039;[Name]Controller&#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;
/**&lt;br /&gt;
 * Content Controller&lt;br /&gt;
 * @package Joomla&lt;br /&gt;
 */&lt;br /&gt;
class ContentController extends JController&lt;br /&gt;
{&lt;br /&gt;
    // Methods&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The file name will generally be &#039;&#039;controller.php&#039;&#039; and is located in the component folder.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
com_content&lt;br /&gt;
 / controller.php&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a multi-controller components, such as the Banners in the Administrator, the convention is &#039;&#039;[Component]Controller[Name]&#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;
/**&lt;br /&gt;
 * Banner Client Controller&lt;br /&gt;
 * @package Joomla&lt;br /&gt;
 */&lt;br /&gt;
class BannerControllerClient extends JController&lt;br /&gt;
{&lt;br /&gt;
    // Methods&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The files will be located in a &amp;lt;tt&amp;gt;/controllers/&amp;lt;/tt&amp;gt; folder under the component folder.  The file names will reflect the name of the controller.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
com_banner&lt;br /&gt;
  /controllers/&lt;br /&gt;
    / banner.php&lt;br /&gt;
    / client.php&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Models===&lt;br /&gt;
&lt;br /&gt;
The naming convention is &#039;&#039;[Component]Model[Name]&#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;
/**&lt;br /&gt;
 * Banner Client Model&lt;br /&gt;
 * @package Joomla&lt;br /&gt;
 */&lt;br /&gt;
class BannerModelClient extends JModel&lt;br /&gt;
{&lt;br /&gt;
    // Methods&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The files will be located in a &amp;lt;tt&amp;gt;/models/&amp;lt;/tt&amp;gt; folder under the component folder.  The file names will reflect the name of the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
com_banner&lt;br /&gt;
  /models/&lt;br /&gt;
    / banner.php&lt;br /&gt;
    / client.php&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Views ===&lt;br /&gt;
The naming convention is &#039;&#039;[Component]View[Name]&#039;&#039;.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * Contact Category View&lt;br /&gt;
 * @package Joomla&lt;br /&gt;
 */&lt;br /&gt;
class ContactViewCategory extends JView&lt;br /&gt;
{&lt;br /&gt;
    // Methods&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The files will be located in a &amp;lt;tt&amp;gt;/view/&amp;lt;/tt&amp;gt; folder under the component folder. The subfolder names will reflect the name of a View.&lt;br /&gt;
&lt;br /&gt;
 com_contact&lt;br /&gt;
  /views/&lt;br /&gt;
    /&#039;&#039;view name 1&#039;&#039;/&lt;br /&gt;
      / view.html.php&lt;br /&gt;
    /&#039;&#039;view name 2&#039;&#039;/&lt;br /&gt;
      / view.html.php&lt;br /&gt;
&lt;br /&gt;
Multi-view components such as com_content may provide an optional &amp;quot;master&amp;quot; view class the specialised views extend from. It is located in the component folder and typically called &#039;&#039;view.php&#039;&#039;. The naming convention is &#039;&#039;[Component]View&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 com_content&lt;br /&gt;
  /views/&lt;br /&gt;
     &amp;lt;span style=&amp;quot;color:#999&amp;quot;&amp;gt;/archive/&amp;lt;/span&amp;gt;&lt;br /&gt;
       / view.html.php&lt;br /&gt;
     &amp;lt;span style=&amp;quot;color:#999&amp;quot;&amp;gt;/article/&amp;lt;/span&amp;gt;&lt;br /&gt;
  / view.php&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
view.php&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * Content View&lt;br /&gt;
 * @package Joomla&lt;br /&gt;
 */&lt;br /&gt;
class ContentView extends JView&lt;br /&gt;
{&lt;br /&gt;
    // Helper Methods&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
views/archive/view.html.php&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * Content Archive View&lt;br /&gt;
 * @package Joomla&lt;br /&gt;
 */&lt;br /&gt;
class ContactViewArchive extends ContentView&lt;br /&gt;
{&lt;br /&gt;
    // Methods&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plugins ===&lt;br /&gt;
&lt;br /&gt;
The naming convention is &#039;&#039;plg[Folder][Element]&#039;&#039; as pointed out in [[Creating a content plugin|the relevant tutorial]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
class plgContentPagebreak extends JPlugin&lt;br /&gt;
{&lt;br /&gt;
    // Methods&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Layouts ===&lt;br /&gt;
Components may support different Layouts to render the data supplied by a [[#Views|View]] and its [[#Models|Models]]. A Layout file usually contains markup and some PHP code for &#039;&#039;display logic only&#039;&#039;: no functions, no classes.&lt;br /&gt;
&lt;br /&gt;
A Layout consists of at least one .php file and an equally named [[Creating a basic layout.xml file|.xml manifest file]] located in the &amp;lt;tt&amp;gt;/tmpl/&amp;lt;/tt&amp;gt; folder of a View, both reflect the internal name of the Layout. The standard Layout is called &#039;&#039;default&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#999&amp;quot;&amp;gt;com_content&lt;br /&gt;
   /views/&lt;br /&gt;
     /article/&amp;lt;/span&amp;gt;&amp;lt;span style=&amp;quot;color:#000&amp;quot;&amp;gt;&lt;br /&gt;
       /tmpl/&lt;br /&gt;
         / default.php&lt;br /&gt;
         / default.xml&lt;br /&gt;
         / form.php&lt;br /&gt;
         / form.xml&lt;br /&gt;
         / pagebreak.php&lt;br /&gt;
         / pagebreak.xml &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Layout may use supplemental .php files to provide more granule control in order to render individual parts or repetitive items of the data.&lt;br /&gt;
&lt;br /&gt;
Users may customize the Layout output via [[#Template Layout Overrides|Template Layout Overrides]].&lt;br /&gt;
&lt;br /&gt;
=== Templates ===&lt;br /&gt;
&lt;br /&gt;
=== Template Layout Overrides ===&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Kissaki</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Coding_style_and_standards&amp;diff=66779</id>
		<title>Coding style and standards</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Coding_style_and_standards&amp;diff=66779"/>
		<updated>2012-04-21T23:18:55Z</updated>

		<summary type="html">&lt;p&gt;Kissaki: /* Language Keys */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{RightTOC}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #ffc; border: 2px solid orange; padding: 0.5em;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- This needs some more emphasis =;) --&amp;gt;&lt;br /&gt;
==New Coding Standards Apply as of December 2011==&lt;br /&gt;
&#039;&#039;As of December 2011, this document has been replaced by newer [http://developer.joomla.org/coding-standards.html coding standards on the Joomla Developer Network]. Please use that document for the current versions of Joomla and the Joomla Platform. The older document is kept here for historical reference.&#039;&#039;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Good coding standards are important in any development project, but particularly when multiple developers are working on the same project. Having coding standards helps ensure that the code is of high quality, has fewer bugs, and is easily maintained.&lt;br /&gt;
&lt;br /&gt;
First rule, if in doubt, ask. There is [[Joomla_CodeSniffer|a tool available]] to help your code conform to the standards.&lt;br /&gt;
&lt;br /&gt;
== File Format ==&lt;br /&gt;
All files contributed to Joomla must:&lt;br /&gt;
&lt;br /&gt;
* Be stored as ASCII text&lt;br /&gt;
* Use UTF-8 character encoding&lt;br /&gt;
* Be Unix formatted&lt;br /&gt;
*:Lines must end only with a line feed (LF). Line feeds are represented as ordinal 10, octal 012 and hex 0A. Do not use carriage returns (CR) like Macintosh computers do or the carriage return/line feed combination (CRLF) like Windows computers do.&lt;br /&gt;
&lt;br /&gt;
New files will normally be added to the code base using Subversion (SVN). All SVN files should have the SVN property set &amp;quot;eol-style=LF&amp;quot;. Also, most Joomla! files will have &amp;quot;$Id&amp;quot; tags in the &amp;quot;@version&amp;quot; line of the Doc block. These require the SVN property &amp;quot;keywords=Id&amp;quot;. See [[Subversion File Properties]] for more information about how to set SVN properties.&lt;br /&gt;
&lt;br /&gt;
== Coding Standards ==&lt;br /&gt;
&lt;br /&gt;
=== Spelling ===&lt;br /&gt;
&lt;br /&gt;
Spelling of class, function, variable and constant names should generally be in accordance with British English rules (en_GB).  However, some exceptions are permitted, for example where common programming names are used that align with the PHP API such as &amp;lt;code&amp;gt;$color&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== E_STRICT-compatible code ===&lt;br /&gt;
&lt;br /&gt;
As of version 1.6, all new code that is suggested for inclusion into Joomla must be E_STRICT-compatible. This means that it must not produce any warnings or errors when PHP&#039;s error reporting level is set to E_ALL | E_STRICT.&lt;br /&gt;
&lt;br /&gt;
=== Indenting and Line Length ===&lt;br /&gt;
&lt;br /&gt;
Use tabs to indent, not spaces. Make sure that the tab-stops are set to only 4 spaces in length.&lt;br /&gt;
&lt;br /&gt;
There is no set limit for line length.  Use your judgment based on the nature of the line and readability.&lt;br /&gt;
&lt;br /&gt;
=== Control Structures ===&lt;br /&gt;
&lt;br /&gt;
These include if, for, while, switch, etc. Here is an example of an if statement, as it is the most complicated of the control structures:&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;
if ((condition1) || (condition2)) {&lt;br /&gt;
    action1();&lt;br /&gt;
} else if ((condition3) &amp;amp;&amp;amp; (condition4)) {&lt;br /&gt;
    action2();&lt;br /&gt;
} else {&lt;br /&gt;
    defaultAction();&lt;br /&gt;
    anotherAction();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// optional formatting if it improves readability&lt;br /&gt;
if ((condition1) || (condition2)) {&lt;br /&gt;
    action1();&lt;br /&gt;
} else if ((condition3) &amp;amp;&amp;amp; (condition4)) {&lt;br /&gt;
    action2();&lt;br /&gt;
} else {&lt;br /&gt;
    defaultAction();&lt;br /&gt;
    anotherAction();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Control statements should have one space between the control keyword and opening parenthesis, to distinguish them from function calls.&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;&#039;layouts&#039;&#039;&#039;, the alternative named notation should be used:&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;
if ((condition1) OR (condition2)) :&lt;br /&gt;
    action1();&lt;br /&gt;
elseif ((condition3) AND (condition4)) :&lt;br /&gt;
    action2();&lt;br /&gt;
else :&lt;br /&gt;
    defaultAction();&lt;br /&gt;
    anotherAction();&lt;br /&gt;
endif;&lt;br /&gt;
&lt;br /&gt;
foreach ($array as $element) :&lt;br /&gt;
    echo $element;&lt;br /&gt;
endforeach;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Logical operators in condition statements should use uppercase words (&amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt;, etc) rather than programmatic notation (&amp;lt;code&amp;gt;&amp;amp;&amp;amp;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;||&amp;lt;/code&amp;gt;, etc).&lt;br /&gt;
&lt;br /&gt;
With the exception of &amp;lt;code&amp;gt;case&amp;lt;/code&amp;gt; statements, curly braces must always be included even though they are technically optional. Having them increases readability and decreases the likelihood of logic errors being introduced when new lines are added.&lt;br /&gt;
&lt;br /&gt;
For switch statements:&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;
switch (condition) {&lt;br /&gt;
    case 1:&lt;br /&gt;
        doAction1();&lt;br /&gt;
        break;&lt;br /&gt;
    case 2:&lt;br /&gt;
        doAction2();&lt;br /&gt;
        break;&lt;br /&gt;
    default:&lt;br /&gt;
        doDefaultAction();&lt;br /&gt;
        break;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use indenting and line-breaks rather than curly braces in the &amp;lt;code&amp;gt;case&amp;lt;/code&amp;gt; statements to increase readability.  There should be no space between the condition and the colon in the &amp;lt;code&amp;gt;case&amp;lt;/code&amp;gt; statement.&lt;br /&gt;
&lt;br /&gt;
=== Function Calls ===&lt;br /&gt;
&lt;br /&gt;
Functions should be called with no spaces between the function name and the opening parenthesis, and no space between this and the first parameter; a space after the comma between each parameter (if they are present), and no space between the last parameter and the closing parenthesis, and the semicolon. Here&#039;s an example:&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;
$var = foo($bar, $baz, $quux);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As displayed above, there should be space before and one space after the equals sign used to assign the return value of a function to a variable. In the case of a block of related assignments, tabs (not spaces) may be inserted to promote readability:&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;
$short          = foo($bar);&lt;br /&gt;
$long_variable  = foo($baz);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Function Definitions ===&lt;br /&gt;
&lt;br /&gt;
Class and function declarations follow this convention:&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;
function fooFunction($arg1, $arg2 = &#039;&#039;)&lt;br /&gt;
{&lt;br /&gt;
    if (condition) {&lt;br /&gt;
        statement;&lt;br /&gt;
    }&lt;br /&gt;
    return $val;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class fooClass&lt;br /&gt;
{&lt;br /&gt;
    function fooMethod($arg1)&lt;br /&gt;
    {&lt;br /&gt;
        if ($arg) {&lt;br /&gt;
            $result = true;&lt;br /&gt;
        } else {&lt;br /&gt;
            $result = false;&lt;br /&gt;
        }&lt;br /&gt;
        return $result;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arguments with default values go at the end of the argument list. Always attempt to return a meaningful value from a function if one is appropriate. Here is a slightly longer example:&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;
function connect(&amp;amp;$dsn, $persistent = false)&lt;br /&gt;
{&lt;br /&gt;
    if (is_array($dsn)) {&lt;br /&gt;
        $dsninfo = &amp;amp;$dsn;&lt;br /&gt;
    } else {&lt;br /&gt;
        $dsninfo = DB::parseDSN($dsn);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if (!$dsninfo OR !$dsninfo[&#039;phptype&#039;]) {&lt;br /&gt;
        return $this-&amp;gt;raiseError();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return true;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Comments ===&lt;br /&gt;
&lt;br /&gt;
Inline documentation for classes should follow the PHPDoc convention, similar to Javadoc. More information about PHPDoc can be found on http://www.phpdoc.org/. There is a [[/Comments|standard for inline documentation comments]].&lt;br /&gt;
&lt;br /&gt;
Non-documentation comments are strongly encouraged. A general rule of thumb is that if you look at a section of code and think &amp;quot;Wow, I don&#039;t want to try and describe that&amp;quot;, you need to comment it before you forget how it works.&lt;br /&gt;
&lt;br /&gt;
C style comments (&amp;lt;tt&amp;gt;/* */&amp;lt;/tt&amp;gt;) and standard C++ comments (&amp;lt;tt&amp;gt;//&amp;lt;/tt&amp;gt;) are both satisfactory. Use of Perl/shell style comments (&amp;lt;tt&amp;gt;#&amp;lt;/tt&amp;gt;) is not permitted.&lt;br /&gt;
&lt;br /&gt;
Please note - &#039;&#039;&#039;code&#039;&#039;&#039; that has been &amp;quot;commented out&amp;quot; is not to be committed to trunk or release repositories.&lt;br /&gt;
&lt;br /&gt;
=== Including Code ===&lt;br /&gt;
&lt;br /&gt;
Anywhere you are unconditionally including a class file, use &amp;lt;code&amp;gt;require_once&amp;lt;/code&amp;gt;. Anywhere you are conditionally including a class file (for example, factory methods), use &amp;lt;code&amp;gt;include_once&amp;lt;/code&amp;gt;. Either of these will ensure that class files are included only once. They share the same file list, so you don&#039;t need to worry about mixing them -- a file included with &amp;lt;code&amp;gt;require_once&amp;lt;/code&amp;gt; will not be included again by &amp;lt;/code&amp;gt;include_once&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;Note: [[php:include_once|include_once]] and [[php:require_once|require_once]] are PHP &#039;&#039;language statements&#039;&#039;, not functions. You don&#039;t need parentheses around the filename to be included.&lt;br /&gt;
&lt;br /&gt;
=== PHP Code Tags ===&lt;br /&gt;
&lt;br /&gt;
Always use &amp;lt;tt&amp;gt;&amp;amp;lt;?php ?&amp;gt;&amp;lt;/tt&amp;gt; to delimit PHP code, not the &amp;lt;tt&amp;gt;&amp;amp;lt;? ?&amp;gt;&amp;lt;/tt&amp;gt; shorthand. This is the most portable way to include PHP code on differing operating systems and setups.&lt;br /&gt;
&lt;br /&gt;
For files that contain only PHP code, the closing tag (&amp;lt;tt&amp;gt;?&amp;gt;&amp;lt;/tt&amp;gt;) is never permitted. It is not required by PHP. Not including it prevents trailing white space from being accidentally injected into the output (see PHP manual on [http://au.php.net/basic-syntax.instruction-separation instruction separation]).&lt;br /&gt;
&lt;br /&gt;
=== SQL Queries ===&lt;br /&gt;
&lt;br /&gt;
SQL keywords are to be written in uppercase, while all other identifiers (which the exception of quoted text obviously) is to be in lowercase. Carriage returns should not be used as [[JDatabase]]::getQuery provides for formatted output.  However, indenting with spaces to improve readability is desireable.&lt;br /&gt;
&lt;br /&gt;
Queries should be wrapped in single quotes (as these text blocks are parsed faster by php).&lt;br /&gt;
&lt;br /&gt;
All quoted strings must use the &#039;&#039;Quote&#039;&#039; method to facilitate future compatibility with other database engines.&lt;br /&gt;
&lt;br /&gt;
All table names should use the &#039;&#039;&#039;&amp;lt;tt&amp;gt;#_&amp;lt;/tt&amp;gt;&#039;&#039;&#039; prefix rather than &amp;lt;tt&amp;gt;jos_&amp;lt;/tt&amp;gt; to access Joomla! contents and allow for the [[screen.config.15#Database_Settings|user defined database prefix]] to be applied.&lt;br /&gt;
&lt;br /&gt;
All expected integer or floating-point variable must be [http://php.net/manual/language.types.type-juggling.php cast] with &amp;lt;tt&amp;gt;(int)&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;(float)&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;(double)&amp;lt;/tt&amp;gt; as appropriate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
$state = 1;&lt;br /&gt;
$name  = &#039;bill&#039;;&lt;br /&gt;
$db    = &amp;amp;JFactory::getDBO();&lt;br /&gt;
$query = &#039;SELECT COUNT( c.id ) AS num_articles, u.id, u.username&#039;.&lt;br /&gt;
    &#039; FROM #__content AS c&#039;.&lt;br /&gt;
    &#039; LEFT JOIN #__users AS u ON u.id = c.created_by&#039;.&lt;br /&gt;
    &#039; WHERE c.state = &#039;.(int) $state&lt;br /&gt;
    &#039;  AND u.id IS NOT NULL&#039;.&lt;br /&gt;
    &#039;  AND u.username &amp;lt;&amp;gt; &#039;.$db-&amp;gt;Quote( $name ).&lt;br /&gt;
    &#039; GROUP BY u.id&#039;.&lt;br /&gt;
    &#039;  HAVING COUNT( c.id ) &amp;gt; 0&#039;;&lt;br /&gt;
$db-&amp;gt;setQuery();&lt;br /&gt;
// Output formated query if joomla debug is active:&lt;br /&gt;
if (JDEBUG) {&lt;br /&gt;
    echo $db-&amp;gt;getQuery();&lt;br /&gt;
}&lt;br /&gt;
$stats = $db-&amp;gt;loadObjectList();&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Doc Blocks ===&lt;br /&gt;
&lt;br /&gt;
All source code files in the core Joomla distribution must contain the following comment block as the header:&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;
/**&lt;br /&gt;
 * Short description of file&lt;br /&gt;
 *&lt;br /&gt;
 * Longer description of file is optional, but should be included if the file contains multiple classes or non-class material.&lt;br /&gt;
 *&lt;br /&gt;
 * PHP version 5.2.4 (put in the minimum version of PHP expected for the code here to run)&lt;br /&gt;
 *&lt;br /&gt;
 * @version	$Id$&lt;br /&gt;
 * @package	Joomla&lt;br /&gt;
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.&lt;br /&gt;
 * @license	GNU/GPL, see LICENSE.php&lt;br /&gt;
 */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;@package&amp;lt;/code&amp;gt; in the header is not required for class-only files.&lt;br /&gt;
&lt;br /&gt;
Classes, functions, constants, class properties and class methods should all be supplied with appropriate DocBlocks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Short description for class&lt;br /&gt;
 *&lt;br /&gt;
 * Long description for class (if any)...&lt;br /&gt;
 *&lt;br /&gt;
 * @package    PackageName&lt;br /&gt;
 * @subpackage SubPackageName&lt;br /&gt;
 * @link       http://pear.php.net/package/PackageName&lt;br /&gt;
 * @see        NetOther, Net_Sample::Net_Sample()&lt;br /&gt;
 * @since      Class available since Release 1.2.0&lt;br /&gt;
 * @deprecated Class deprecated in Release 2.0.0&lt;br /&gt;
 */&lt;br /&gt;
class JFooBar&lt;br /&gt;
{&lt;br /&gt;
    /**&lt;br /&gt;
     * @var int $id Primary key&lt;br /&gt;
     */&lt;br /&gt;
    public $id = null;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following package names are to be used in the core stack:&lt;br /&gt;
&lt;br /&gt;
* Joomla.Administrator - all files that belong only to the administrator or backend application&lt;br /&gt;
* Joomla.Installation - all files that belong to the installation application&lt;br /&gt;
* Joomla.Plugin - all plugin files&lt;br /&gt;
* Joomla.Site - all files that pertain only to the site or frontend application&lt;br /&gt;
* Joomla.XML-RPC - all files that belong to the XML-RPC server application&lt;br /&gt;
&lt;br /&gt;
The sub-package name will vary according to the extension type:&lt;br /&gt;
&lt;br /&gt;
* Components - the component folder, eg &amp;lt;code&amp;gt;com_content&amp;lt;/code&amp;gt;&lt;br /&gt;
* Modules - the module folder, eg &amp;lt;code&amp;gt;mod_latest_news&amp;lt;/code&amp;gt;&lt;br /&gt;
* Plugins - the folder.element, eg &amp;lt;code&amp;gt;content.pagebreak&amp;lt;/code&amp;gt;&lt;br /&gt;
* Templates - the template folder, eg &amp;lt;code&amp;gt;rhuk_milkyway&amp;lt;/code&amp;gt;&lt;br /&gt;
* Framework - nothing for top level files (such as &amp;lt;code&amp;gt;factory.php&amp;lt;/code&amp;gt;), the first level folder or the first.second level folders as appropriate, eg &amp;lt;code&amp;gt;utilities&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;joomla/utilities/date.php&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;html.html&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;joomla/html/html/email.php&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that code contributed to the Joomla stack that will become the copyright of the project is not allowed to include &amp;lt;code&amp;gt;@author&amp;lt;/code&amp;gt; tags.  You should update the contribution log in &amp;lt;tt&amp;gt;CREDITS.php&amp;lt;/tt&amp;gt;.  Joomla&#039;s philosophy is that the code is written &amp;quot;all together&amp;quot; and there is no notion of any one person &#039;owning&#039; any section of code.&lt;br /&gt;
&lt;br /&gt;
Files included from third party sources must leave DocBlocks intact. Layout files use the same DocBlocks as other PHP files. &lt;br /&gt;
&lt;br /&gt;
Note that the &amp;quot;@version $Id&amp;quot; line uses the SVN &amp;quot;keywords=Id&amp;quot; property. See [[Subversion File Properties]] for information about setting this property.&lt;br /&gt;
&lt;br /&gt;
== Naming Conventions ==&lt;br /&gt;
&lt;br /&gt;
=== Classes ===&lt;br /&gt;
&lt;br /&gt;
Classes should be given descriptive names. Avoid using abbreviations where possible. Class names should always begin with an uppercase letter and be written in CamelCase even if using traditionally uppercase acronyms (such as XML, HTML).  One exception is for Joomla framework classes which must begin with an uppercase &#039;J&#039; with the next letter also being uppercase.  For example:&lt;br /&gt;
&lt;br /&gt;
* JHtmlHelper&lt;br /&gt;
* JXmlParser&lt;br /&gt;
* JModel&lt;br /&gt;
&lt;br /&gt;
Third-party developers are advised to namespace their functions with a unique prefix.&lt;br /&gt;
&lt;br /&gt;
=== Functions and Methods ===&lt;br /&gt;
&lt;br /&gt;
Functions and methods should be named using the &amp;quot;studly caps&amp;quot; style (also referred to as &amp;quot;bumpy case&amp;quot; or &amp;quot;camel caps&amp;quot;). The initial letter of the name is lowercase, and each letter that starts a new &amp;quot;word&amp;quot; is capitalized. Function in the Joomla framework must begin with a lowercase &#039;j&#039;.  Some examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
connect();&lt;br /&gt;
getData();&lt;br /&gt;
buildSomeWidget();&lt;br /&gt;
jImport();&lt;br /&gt;
jDoSomething();&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Private class members (meaning class members that are intended to be used only from within the same class in which they are declared; are preceded by a single underscore. Properties are to be written in underscore format (that is, logical words separated by underscores) and should be all lowercase.  For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
class JFooBar&lt;br /&gt;
{&lt;br /&gt;
    // Joomla 1.5 and earlier format&lt;br /&gt;
    var $_status = null;&lt;br /&gt;
&lt;br /&gt;
    function _sort()&lt;br /&gt;
    {&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Joomla 1.6 format&lt;br /&gt;
    private $_status = null;&lt;br /&gt;
&lt;br /&gt;
    protected $field_name = null;&lt;br /&gt;
&lt;br /&gt;
    protected function _sort()&lt;br /&gt;
    {&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Constants ===&lt;br /&gt;
&lt;br /&gt;
Constants should always be all-uppercase, with underscores to separate words. Prefix constant names with the uppercase name of the class/package they are used in. For example, the constants used by the [[JError]] class all begin with &amp;quot;JERROR_&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Global Variables ===&lt;br /&gt;
&lt;br /&gt;
If your package needs to define global variables, their name should start with a single underscore followed by the uppercase class/package name and another underscore. For example, the JError class uses a global variable called $_JERROR_LEVELS.&lt;br /&gt;
&lt;br /&gt;
With PHP5 and later you may use static class properties or constants instead of globals.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
class JWhatever&lt;br /&gt;
{&lt;br /&gt;
    public static $instance = null;&lt;br /&gt;
    const SUCCESS = 1;&lt;br /&gt;
    const FAILURE = 0;&lt;br /&gt;
    // Methods...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Regular and Class Variables ===&lt;br /&gt;
&lt;br /&gt;
Regular variables, follow the same conventions as function.&lt;br /&gt;
&lt;br /&gt;
Class variables should be set to null or some other appropriate default value. Lining up the default values with tabs should only be used if particularly warranted for readability.&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
When using references, there should be a space before the reference operator and no space between it and the function or variable name.  For example:&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;
$ref1  = &amp;amp;$this-&amp;gt;_sql;&lt;br /&gt;
$db    = &amp;amp;JFactory::getDBO();&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Language Keys ===&lt;br /&gt;
&lt;br /&gt;
NOTE: This part has to be rewritten for 1.6 (JM)&lt;br /&gt;
&lt;br /&gt;
Except for the most common of words, such as &amp;quot;Yes&amp;quot;, &amp;quot;No&amp;quot;, &amp;quot;Show&amp;quot;, &amp;quot;Hide&amp;quot; all language keys should be namespaced to reflect the type of string they represent.  Always consider that if two extensions use the same key, the one loaded last will be the one that displays.  Namespacing should generally relate to the extension displaying the text. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
echo JText::_(&#039;Weblink Link&#039;);&lt;br /&gt;
echo JText::_(&#039;Weblink Title&#039;);&lt;br /&gt;
echo JText::_(&#039;Weblink Description&#039;);&lt;br /&gt;
&lt;br /&gt;
echo JText::_(&#039;Exception An error occurred while saving&#039;);&lt;br /&gt;
?&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
TODO: Link to page with &amp;quot;common&amp;quot; strings that can be used for typical actions in components, such as &amp;quot;Save&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Where the same English word is used in two different locations, two different language keys should be used to allow for cases where the translation results in different words or phrases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
// A table column title&lt;br /&gt;
&amp;lt;th&amp;gt;&amp;lt;?php echo JText::_(&#039;Weblink Column Title&#039;);?&amp;gt;&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;&amp;lt;?php echo JText::_(&#039;Weblink Column Link&#039;);?&amp;gt;&amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// In the form&lt;br /&gt;
&amp;lt;?php echo JText::_(&#039;Weblink Title&#039;);?&amp;gt;&amp;lt;input name=&amp;quot;title&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;?php echo JText::_(&#039;Weblink Link&#039;);?&amp;gt;&amp;lt;input name=&amp;quot;link&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Toolbar and Linkbar text should be prefixed Toolbar and Linkbar respectively.&lt;br /&gt;
&lt;br /&gt;
The language keys should be written as naturally as possible with spaces, not underscores separating words.  Long phrases can be condensed to reduce keys to a sensible length.  For example, tooltips for an edit field can be written like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php echo JText::_(&#039;Weblink Title&#039;);?&amp;gt;&amp;lt;input name=&amp;quot;title&amp;quot; title=&amp;quot;&amp;lt;?php echo JText::_(&#039;Weblink Title Desc&#039;);?&amp;gt;&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The convention used should be governed by common sense, but must be consistent.  In general consider how the language file will look with all keys sorted alphabetically.  Prefixes should be used to group text within a common context (such as column headings).  Suffixes should be used to group elements that logically go together (such as a field name and its description).&lt;br /&gt;
&lt;br /&gt;
Phrases must never be assembled by string concatenation. Each phrase must be represented by a single language key, using sprintf as appropriate to replace dynamic words in the phrase.  Where replacements are made, the word used should be as descriptive as possible and all-uppercase.  This assists the translators to determine the context of the replacement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
// Not permitted&lt;br /&gt;
echo JText::_(&#039;Deleted &#039;).$n.JText::_(&#039; items&#039;);&lt;br /&gt;
&lt;br /&gt;
// Permitted&lt;br /&gt;
echo JText::sprintf(&#039;Message Deleted NUMBER items&#039;, $n);&lt;br /&gt;
?&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reference in the language file would look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;MESSAGE DELETED NUMBER ITEMS=Deleted %d Item(s)&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If more than one dynamic string is used in a phrase, the printf markers should employ order placement as other languages might change the position of the strings. This is done via %[number]$[printf_type] as follows:&lt;br /&gt;
&lt;br /&gt;
Left to right language:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;PAGE X OF Y=Page %1$d of %2$d&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right to left language:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;PAGE X OF Y=%2$d of %1$d egaP&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Controllers ===&lt;br /&gt;
&lt;br /&gt;
For single controller components, the naming convention is &#039;&#039;[Name]Controller&#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;
/**&lt;br /&gt;
 * Content Controller&lt;br /&gt;
 * @package Joomla&lt;br /&gt;
 */&lt;br /&gt;
class ContentController extends JController&lt;br /&gt;
{&lt;br /&gt;
    // Methods&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The file name will generally be &#039;&#039;controller.php&#039;&#039; and is located in the component folder.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
com_content&lt;br /&gt;
 / controller.php&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a multi-controller components, such as the Banners in the Administrator, the convention is &#039;&#039;[Component]Controller[Name]&#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;
/**&lt;br /&gt;
 * Banner Client Controller&lt;br /&gt;
 * @package Joomla&lt;br /&gt;
 */&lt;br /&gt;
class BannerControllerClient extends JController&lt;br /&gt;
{&lt;br /&gt;
    // Methods&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The files will be located in a &amp;lt;tt&amp;gt;/controllers/&amp;lt;/tt&amp;gt; folder under the component folder.  The file names will reflect the name of the controller.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
com_banner&lt;br /&gt;
  /controllers/&lt;br /&gt;
    / banner.php&lt;br /&gt;
    / client.php&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Models===&lt;br /&gt;
&lt;br /&gt;
The naming convention is &#039;&#039;[Component]Model[Name]&#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;
/**&lt;br /&gt;
 * Banner Client Model&lt;br /&gt;
 * @package Joomla&lt;br /&gt;
 */&lt;br /&gt;
class BannerModelClient extends JModel&lt;br /&gt;
{&lt;br /&gt;
    // Methods&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The files will be located in a &amp;lt;tt&amp;gt;/models/&amp;lt;/tt&amp;gt; folder under the component folder.  The file names will reflect the name of the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
com_banner&lt;br /&gt;
  /models/&lt;br /&gt;
    / banner.php&lt;br /&gt;
    / client.php&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Views ===&lt;br /&gt;
The naming convention is &#039;&#039;[Component]View[Name]&#039;&#039;.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * Contact Category View&lt;br /&gt;
 * @package Joomla&lt;br /&gt;
 */&lt;br /&gt;
class ContactViewCategory extends JView&lt;br /&gt;
{&lt;br /&gt;
    // Methods&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The files will be located in a &amp;lt;tt&amp;gt;/view/&amp;lt;/tt&amp;gt; folder under the component folder. The subfolder names will reflect the name of a View.&lt;br /&gt;
&lt;br /&gt;
 com_contact&lt;br /&gt;
  /views/&lt;br /&gt;
    /&#039;&#039;view name 1&#039;&#039;/&lt;br /&gt;
      / view.html.php&lt;br /&gt;
    /&#039;&#039;view name 2&#039;&#039;/&lt;br /&gt;
      / view.html.php&lt;br /&gt;
&lt;br /&gt;
Multi-view components such as com_content may provide an optional &amp;quot;master&amp;quot; view class the specialised views extend from. It is located in the component folder and typically called &#039;&#039;view.php&#039;&#039;. The naming convention is &#039;&#039;[Component]View&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 com_content&lt;br /&gt;
  /views/&lt;br /&gt;
     &amp;lt;span style=&amp;quot;color:#999&amp;quot;&amp;gt;/archive/&amp;lt;/span&amp;gt;&lt;br /&gt;
       / view.html.php&lt;br /&gt;
     &amp;lt;span style=&amp;quot;color:#999&amp;quot;&amp;gt;/article/&amp;lt;/span&amp;gt;&lt;br /&gt;
  / view.php&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
view.php&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * Content View&lt;br /&gt;
 * @package Joomla&lt;br /&gt;
 */&lt;br /&gt;
class ContentView extends JView&lt;br /&gt;
{&lt;br /&gt;
    // Helper Methods&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
views/archive/view.html.php&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * Content Archive View&lt;br /&gt;
 * @package Joomla&lt;br /&gt;
 */&lt;br /&gt;
class ContactViewArchive extends ContentView&lt;br /&gt;
{&lt;br /&gt;
    // Methods&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plugins ===&lt;br /&gt;
&lt;br /&gt;
The naming convention is &#039;&#039;plg[Folder][Element]&#039;&#039; as pointed out in [[Creating a content plugin|the relevant tutorial]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
class plgContentPagebreak extends JPlugin&lt;br /&gt;
{&lt;br /&gt;
    // Methods&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Layouts ===&lt;br /&gt;
Components may support different Layouts to render the data supplied by a [[#Views|View]] and its [[#Models|Models]]. A Layout file usually contains markup and some PHP code for &#039;&#039;display logic only&#039;&#039;: no functions, no classes.&lt;br /&gt;
&lt;br /&gt;
A Layout consists of at least one .php file and an equally named [[Creating a basic layout.xml file|.xml manifest file]] located in the &amp;lt;tt&amp;gt;/tmpl/&amp;lt;/tt&amp;gt; folder of a View, both reflect the internal name of the Layout. The standard Layout is called &#039;&#039;default&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#999&amp;quot;&amp;gt;com_content&lt;br /&gt;
   /views/&lt;br /&gt;
     /article/&amp;lt;/span&amp;gt;&amp;lt;span style=&amp;quot;color:#000&amp;quot;&amp;gt;&lt;br /&gt;
       /tmpl/&lt;br /&gt;
         / default.php&lt;br /&gt;
         / default.xml&lt;br /&gt;
         / form.php&lt;br /&gt;
         / form.xml&lt;br /&gt;
         / pagebreak.php&lt;br /&gt;
         / pagebreak.xml &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Layout may use supplemental .php files to provide more granule control in order to render individual parts or repetitive items of the data.&lt;br /&gt;
&lt;br /&gt;
Users may customize the Layout output via [[#Template Layout Overrides|Template Layout Overrides]].&lt;br /&gt;
&lt;br /&gt;
=== Templates ===&lt;br /&gt;
&lt;br /&gt;
=== Template Layout Overrides ===&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Kissaki</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=API17:Platform&amp;diff=59249</id>
		<title>API17:Platform</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=API17:Platform&amp;diff=59249"/>
		<updated>2011-06-04T22:45:30Z</updated>

		<summary type="html">&lt;p&gt;Kissaki: display references&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Framework}}&lt;br /&gt;
{{Description:Platform}}&lt;br /&gt;
&lt;br /&gt;
The following Platform classes are present in version 11.1.&lt;br /&gt;
For other versions see [[Platform]]&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|Class name&lt;br /&gt;
|Subpackage&lt;br /&gt;
|-&lt;br /&gt;
|[[ApplicationException/11.1|ApplicationException]]&lt;br /&gt;
|[[Subpackage Application/11.1|Application]]&lt;br /&gt;
|-&lt;br /&gt;
|[[DatabaseException/11.1|DatabaseException]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JAccess/11.1|JAccess]]&lt;br /&gt;
|[[Subpackage Access/11.1|Access]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JAdapter/11.1|JAdapter]]&lt;br /&gt;
|[[Subpackage Base/11.1|Base]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JAdapterInstance/11.1|JAdapterInstance]]&lt;br /&gt;
|[[Subpackage Base/11.1|Base]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JApplication/11.1|JApplication]]&lt;br /&gt;
|[[Subpackage Application/11.1|Application]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JApplicationHelper/11.1|JApplicationHelper]]&lt;br /&gt;
|[[Subpackage Application/11.1|Application]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JArchive/11.1|JArchive]]&lt;br /&gt;
|[[Subpackage Filesystem/11.1|Filesystem]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JArchiveBzip2/11.1|JArchiveBzip2]]&lt;br /&gt;
|[[Subpackage Filesystem/11.1|Filesystem]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JArchiveGzip/11.1|JArchiveGzip]]&lt;br /&gt;
|[[Subpackage Filesystem/11.1|Filesystem]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JArchiveTar/11.1|JArchiveTar]]&lt;br /&gt;
|[[Subpackage Filesystem/11.1|Filesystem]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JArchiveZip/11.1|JArchiveZip]]&lt;br /&gt;
|[[Subpackage Filesystem/11.1|Filesystem]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JArrayHelper/11.1|JArrayHelper]]&lt;br /&gt;
|[[Subpackage Utilities/11.1|Utilities]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JAuthentication/11.1|JAuthentication]]&lt;br /&gt;
|[[Subpackage User/11.1|User]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JAuthenticationResponse/11.1|JAuthenticationResponse]]&lt;br /&gt;
|[[Subpackage User/11.1|User]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JBrowser/11.1|JBrowser]]&lt;br /&gt;
|[[Subpackage Environment/11.1|Environment]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JBuffer/11.1|JBuffer]]&lt;br /&gt;
|[[Subpackage Utilities/11.1|Utilities]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JButton/11.1|JButton]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JButtonConfirm/11.1|JButtonConfirm]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JButtonCustom/11.1|JButtonCustom]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JButtonHelp/11.1|JButtonHelp]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JButtonLink/11.1|JButtonLink]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JButtonPopup/11.1|JButtonPopup]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JButtonSeparator/11.1|JButtonSeparator]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JButtonStandard/11.1|JButtonStandard]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JCache/11.1|JCache]]&lt;br /&gt;
|[[Subpackage Cache/11.1|Cache]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JCacheController/11.1|JCacheController]]&lt;br /&gt;
|[[Subpackage Cache/11.1|Cache]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JCacheControllerCallback/11.1|JCacheControllerCallback]]&lt;br /&gt;
|[[Subpackage Cache/11.1|Cache]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JCacheControllerOutput/11.1|JCacheControllerOutput]]&lt;br /&gt;
|[[Subpackage Cache/11.1|Cache]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JCacheControllerPage/11.1|JCacheControllerPage]]&lt;br /&gt;
|[[Subpackage Cache/11.1|Cache]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JCacheControllerView/11.1|JCacheControllerView]]&lt;br /&gt;
|[[Subpackage Cache/11.1|Cache]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JCacheStorage/11.1|JCacheStorage]]&lt;br /&gt;
|[[Subpackage Cache/11.1|Cache]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JCacheStorageApc/11.1|JCacheStorageApc]]&lt;br /&gt;
|[[Subpackage Cache/11.1|Cache]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JCacheStorageCachelite/11.1|JCacheStorageCachelite]]&lt;br /&gt;
|[[Subpackage Cache/11.1|Cache]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JCacheStorageEaccelerator/11.1|JCacheStorageEaccelerator]]&lt;br /&gt;
|[[Subpackage Cache/11.1|Cache]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JCacheStorageFile/11.1|JCacheStorageFile]]&lt;br /&gt;
|[[Subpackage Cache/11.1|Cache]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JCacheStorageHelper/11.1|JCacheStorageHelper]]&lt;br /&gt;
|[[Subpackage Cache/11.1|Cache]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JCacheStorageMemcache/11.1|JCacheStorageMemcache]]&lt;br /&gt;
|[[Subpackage Cache/11.1|Cache]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JCacheStorageWincache/11.1|JCacheStorageWincache]]&lt;br /&gt;
|[[Subpackage Cache/11.1|Cache]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JCacheStorageXcache/11.1|JCacheStorageXcache]]&lt;br /&gt;
|[[Subpackage Cache/11.1|Cache]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JCategories/11.1|JCategories]]&lt;br /&gt;
|[[Subpackage Application/11.1|Application]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JCategoryNode/11.1|JCategoryNode]]&lt;br /&gt;
|[[Subpackage Application/11.1|Application]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JCli/11.1|JCli]]&lt;br /&gt;
|[[Subpackage Application/11.1|Application]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JClientHelper/11.1|JClientHelper]]&lt;br /&gt;
|[[Subpackage Client/11.1|Client]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JComponentHelper/11.1|JComponentHelper]]&lt;br /&gt;
|[[Subpackage Application/11.1|Application]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JController/11.1|JController]]&lt;br /&gt;
|[[Subpackage Application/11.1|Application]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JControllerAdmin/11.1|JControllerAdmin]]&lt;br /&gt;
|[[Subpackage Application/11.1|Application]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JControllerForm/11.1|JControllerForm]]&lt;br /&gt;
|[[Subpackage Application/11.1|Application]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDaemon/11.1|JDaemon]]&lt;br /&gt;
|[[Subpackage Application/11.1|Application]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDatabase/11.1|JDatabase]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDatabaseExporterMySQL/11.1|JDatabaseExporterMySQL]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDatabaseExporterMySQLi/11.1|JDatabaseExporterMySQLi]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDatabaseImporterMySQL/11.1|JDatabaseImporterMySQL]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDatabaseImporterMySQLi/11.1|JDatabaseImporterMySQLi]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDatabaseMySQL/11.1|JDatabaseMySQL]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDatabaseMySQLi/11.1|JDatabaseMySQLi]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDatabaseQuery/11.1|JDatabaseQuery]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDatabaseQueryElement/11.1|JDatabaseQueryElement]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDatabaseQueryElementMySQL/11.1|JDatabaseQueryElementMySQL]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDatabaseQueryElementMySQLi/11.1|JDatabaseQueryElementMySQLi]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDatabaseQueryElementSQLAzure/11.1|JDatabaseQueryElementSQLAzure]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDatabaseQueryElementSQLSrv/11.1|JDatabaseQueryElementSQLSrv]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDatabaseQueryMySQL/11.1|JDatabaseQueryMySQL]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDatabaseQueryMySQLi/11.1|JDatabaseQueryMySQLi]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDatabaseQuerySQLAzure/11.1|JDatabaseQuerySQLAzure]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDatabaseQuerySQLSrv/11.1|JDatabaseQuerySQLSrv]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDatabaseSQLAzure/11.1|JDatabaseSQLAzure]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDatabaseSQLSrv/11.1|JDatabaseSQLSrv]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDate/11.1|JDate]]&lt;br /&gt;
|[[Subpackage Utilities/11.1|Utilities]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDispatcher/11.1|JDispatcher]]&lt;br /&gt;
|[[Subpackage Event/11.1|Event]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDocument/11.1|JDocument]]&lt;br /&gt;
|[[Subpackage Document/11.1|Document]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDocumentError/11.1|JDocumentError]]&lt;br /&gt;
|[[Subpackage Document/11.1|Document]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDocumentFeed/11.1|JDocumentFeed]]&lt;br /&gt;
|[[Subpackage Document/11.1|Document]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDocumentHTML/11.1|JDocumentHTML]]&lt;br /&gt;
|[[Subpackage Document/11.1|Document]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDocumentJSON/11.1|JDocumentJSON]]&lt;br /&gt;
|[[Subpackage Document/11.1|Document]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDocumentRAW/11.1|JDocumentRAW]]&lt;br /&gt;
|[[Subpackage Document/11.1|Document]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDocumentRenderer/11.1|JDocumentRenderer]]&lt;br /&gt;
|[[Subpackage Document/11.1|Document]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDocumentRendererAtom/11.1|JDocumentRendererAtom]]&lt;br /&gt;
|[[Subpackage Document/11.1|Document]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDocumentRendererComponent/11.1|JDocumentRendererComponent]]&lt;br /&gt;
|[[Subpackage Document/11.1|Document]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDocumentRendererHead/11.1|JDocumentRendererHead]]&lt;br /&gt;
|[[Subpackage Document/11.1|Document]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDocumentRendererMessage/11.1|JDocumentRendererMessage]]&lt;br /&gt;
|[[Subpackage Document/11.1|Document]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDocumentRendererModule/11.1|JDocumentRendererModule]]&lt;br /&gt;
|[[Subpackage Document/11.1|Document]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDocumentRendererModules/11.1|JDocumentRendererModules]]&lt;br /&gt;
|[[Subpackage Document/11.1|Document]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDocumentRendererRSS/11.1|JDocumentRendererRSS]]&lt;br /&gt;
|[[Subpackage Document/11.1|Document]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JDocumentXML/11.1|JDocumentXML]]&lt;br /&gt;
|[[Subpackage Document/11.1|Document]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JEditor/11.1|JEditor]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JElement/11.1|JElement]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JElementCalendar/11.1|JElementCalendar]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JElementCategory/11.1|JElementCategory]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JElementComponentLayouts/11.1|JElementComponentLayouts]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JElementContentLanguages/11.1|JElementContentLanguages]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JElementEditors/11.1|JElementEditors]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JElementFilelist/11.1|JElementFilelist]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JElementFolderlist/11.1|JElementFolderlist]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JElementHelpsites/11.1|JElementHelpsites]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JElementHidden/11.1|JElementHidden]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JElementImageList/11.1|JElementImageList]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JElementLanguages/11.1|JElementLanguages]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JElementList/11.1|JElementList]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JElementMenu/11.1|JElementMenu]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JElementMenuItem/11.1|JElementMenuItem]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JElementModuleLayouts/11.1|JElementModuleLayouts]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JElementPassword/11.1|JElementPassword]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JElementRadio/11.1|JElementRadio]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JElementSpacer/11.1|JElementSpacer]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JElementSQL/11.1|JElementSQL]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JElementTemplateStyle/11.1|JElementTemplateStyle]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JElementText/11.1|JElementText]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JElementTextarea/11.1|JElementTextarea]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JElementTimezones/11.1|JElementTimezones]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JElementUserGroup/11.1|JElementUserGroup]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JError/11.1|JError]]&lt;br /&gt;
|[[Subpackage Error/11.1|Error]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JEvent/11.1|JEvent]]&lt;br /&gt;
|[[Subpackage Event/11.1|Event]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JException/11.1|JException]]&lt;br /&gt;
|[[Subpackage Error/11.1|Error]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JExtension/11.1|JExtension]]&lt;br /&gt;
|[[Subpackage Installer/11.1|Installer]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFactory/11.1|JFactory]]&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|[[JFeedEnclosure/11.1|JFeedEnclosure]]&lt;br /&gt;
|[[Subpackage Document/11.1|Document]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFeedImage/11.1|JFeedImage]]&lt;br /&gt;
|[[Subpackage Document/11.1|Document]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFeedItem/11.1|JFeedItem]]&lt;br /&gt;
|[[Subpackage Document/11.1|Document]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFile/11.1|JFile]]&lt;br /&gt;
|[[Subpackage Filesystem/11.1|Filesystem]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFilesystemHelper/11.1|JFilesystemHelper]]&lt;br /&gt;
|[[Subpackage Filesystem/11.1|Filesystem]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFilterInput/11.1|JFilterInput]]&lt;br /&gt;
|[[Subpackage Filter/11.1|Filter]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFilterOutput/11.1|JFilterOutput]]&lt;br /&gt;
|[[Subpackage Filter/11.1|Filter]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFolder/11.1|JFolder]]&lt;br /&gt;
|[[Subpackage Filesystem/11.1|Filesystem]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JForm/11.1|JForm]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormField/11.1|JFormField]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldAccessLevel/11.1|JFormFieldAccessLevel]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldCacheHandler/11.1|JFormFieldCacheHandler]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldCalendar/11.1|JFormFieldCalendar]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldCategory/11.1|JFormFieldCategory]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldCheckbox/11.1|JFormFieldCheckbox]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldCheckboxes/11.1|JFormFieldCheckboxes]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldCombo/11.1|JFormFieldCombo]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldComponentLayout/11.1|JFormFieldComponentLayout]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldContentLanguage/11.1|JFormFieldContentLanguage]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldEditor/11.1|JFormFieldEditor]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldEditors/11.1|JFormFieldEditors]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldEMail/11.1|JFormFieldEMail]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldFile/11.1|JFormFieldFile]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldFileList/11.1|JFormFieldFileList]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldFolderList/11.1|JFormFieldFolderList]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldGroupedList/11.1|JFormFieldGroupedList]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldHelpsite/11.1|JFormFieldHelpsite]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldHidden/11.1|JFormFieldHidden]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldImageList/11.1|JFormFieldImageList]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldInteger/11.1|JFormFieldInteger]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldLanguage/11.1|JFormFieldLanguage]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldList/11.1|JFormFieldList]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldMedia/11.1|JFormFieldMedia]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldMenu/11.1|JFormFieldMenu]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldMenuItem/11.1|JFormFieldMenuItem]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldModuleLayout/11.1|JFormFieldModuleLayout]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldPassword/11.1|JFormFieldPassword]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldRadio/11.1|JFormFieldRadio]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldRules/11.1|JFormFieldRules]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldSessionHandler/11.1|JFormFieldSessionHandler]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldSpacer/11.1|JFormFieldSpacer]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldSQL/11.1|JFormFieldSQL]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldTel/11.1|JFormFieldTel]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldTemplateStyle/11.1|JFormFieldTemplateStyle]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldText/11.1|JFormFieldText]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldTextarea/11.1|JFormFieldTextarea]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldTimezone/11.1|JFormFieldTimezone]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldUrl/11.1|JFormFieldUrl]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldUser/11.1|JFormFieldUser]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormFieldUsergroup/11.1|JFormFieldUsergroup]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormHelper/11.1|JFormHelper]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormRule/11.1|JFormRule]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormRuleBoolean/11.1|JFormRuleBoolean]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormRuleEmail/11.1|JFormRuleEmail]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormRuleEquals/11.1|JFormRuleEquals]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormRuleRules/11.1|JFormRuleRules]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormRuleTel/11.1|JFormRuleTel]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFormRuleUsername/11.1|JFormRuleUsername]]&lt;br /&gt;
|[[Subpackage Form/11.1|Form]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JFTP/11.1|JFTP]]&lt;br /&gt;
|[[Subpackage Client/11.1|Client]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JHelp/11.1|JHelp]]&lt;br /&gt;
|[[Subpackage Language/11.1|Language]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JHtml/11.1|JHtml]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JHtmlAccess/11.1|JHtmlAccess]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JHtmlBehavior/11.1|JHtmlBehavior]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JHtmlCategory/11.1|JHtmlCategory]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JHtmlContent/11.1|JHtmlContent]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JHtmlContentLanguage/11.1|JHtmlContentLanguage]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JHtmlEmail/11.1|JHtmlEmail]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JHtmlForm/11.1|JHtmlForm]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JHtmlGrid/11.1|JHtmlGrid]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JHtmlImage/11.1|JHtmlImage]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JHtmlJGrid/11.1|JHtmlJGrid]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JHtmlList/11.1|JHtmlList]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JHtmlMenu/11.1|JHtmlMenu]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JHtmlNumber/11.1|JHtmlNumber]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JHtmlRules/11.1|JHtmlRules]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JHtmlSelect/11.1|JHtmlSelect]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JHtmlSliders/11.1|JHtmlSliders]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JHtmlString/11.1|JHtmlString]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JHtmlTabs/11.1|JHtmlTabs]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JHtmlTel/11.1|JHtmlTel]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JHttp/11.1|JHttp]]&lt;br /&gt;
|[[Subpackage Client/11.1|Client]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JHttpResponse/11.1|JHttpResponse]]&lt;br /&gt;
|[[Subpackage Client/11.1|Client]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JInput/11.1|JInput]]&lt;br /&gt;
|[[Subpackage Application/11.1|Application]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JInputCLI/11.1|JInputCLI]]&lt;br /&gt;
|[[Subpackage Application/11.1|Application]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JInputCookie/11.1|JInputCookie]]&lt;br /&gt;
|[[Subpackage Application/11.1|Application]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JInputFiles/11.1|JInputFiles]]&lt;br /&gt;
|[[Subpackage Application/11.1|Application]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JInstaller/11.1|JInstaller]]&lt;br /&gt;
|[[Subpackage Installer/11.1|Installer]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JInstallerComponent/11.1|JInstallerComponent]]&lt;br /&gt;
|[[Subpackage Installer/11.1|Installer]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JInstallerFile/11.1|JInstallerFile]]&lt;br /&gt;
|[[Subpackage Installer/11.1|Installer]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JInstallerHelper/11.1|JInstallerHelper]]&lt;br /&gt;
|[[Subpackage Installer/11.1|Installer]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JInstallerLanguage/11.1|JInstallerLanguage]]&lt;br /&gt;
|[[Subpackage Installer/11.1|Installer]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JInstallerLibrary/11.1|JInstallerLibrary]]&lt;br /&gt;
|[[Subpackage Installer/11.1|Installer]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JInstallerModule/11.1|JInstallerModule]]&lt;br /&gt;
|[[Subpackage Installer/11.1|Installer]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JInstallerPackage/11.1|JInstallerPackage]]&lt;br /&gt;
|[[Subpackage Installer/11.1|Installer]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JInstallerPlugin/11.1|JInstallerPlugin]]&lt;br /&gt;
|[[Subpackage Installer/11.1|Installer]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JInstallerTemplate/11.1|JInstallerTemplate]]&lt;br /&gt;
|[[Subpackage Installer/11.1|Installer]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JLanguage/11.1|JLanguage]]&lt;br /&gt;
|[[Subpackage Language/11.1|Language]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JLanguageHelper/11.1|JLanguageHelper]]&lt;br /&gt;
|[[Subpackage Language/11.1|Language]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JLanguageTransliterate/11.1|JLanguageTransliterate]]&lt;br /&gt;
|[[Subpackage Language/11.1|Language]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JLDAP/11.1|JLDAP]]&lt;br /&gt;
|[[Subpackage Client/11.1|Client]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JLibraryManifest/11.1|JLibraryManifest]]&lt;br /&gt;
|[[Subpackage Installer/11.1|Installer]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JLog/11.1|JLog]]&lt;br /&gt;
|[[Subpackage Log/11.1|Log]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JLogEntry/11.1|JLogEntry]]&lt;br /&gt;
|[[Subpackage Log/11.1|Log]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JLogger/11.1|JLogger]]&lt;br /&gt;
|[[Subpackage Log/11.1|Log]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JLoggerDatabase/11.1|JLoggerDatabase]]&lt;br /&gt;
|[[Subpackage Log/11.1|Log]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JLoggerEcho/11.1|JLoggerEcho]]&lt;br /&gt;
|[[Subpackage Log/11.1|Log]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JLoggerFormattedText/11.1|JLoggerFormattedText]]&lt;br /&gt;
|[[Subpackage Log/11.1|Log]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JLoggerMessageQueue/11.1|JLoggerMessageQueue]]&lt;br /&gt;
|[[Subpackage Log/11.1|Log]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JLoggerSysLog/11.1|JLoggerSysLog]]&lt;br /&gt;
|[[Subpackage Log/11.1|Log]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JLoggerW3C/11.1|JLoggerW3C]]&lt;br /&gt;
|[[Subpackage Log/11.1|Log]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JMail/11.1|JMail]]&lt;br /&gt;
|[[Subpackage Mail/11.1|Mail]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JMailHelper/11.1|JMailHelper]]&lt;br /&gt;
|[[Subpackage Mail/11.1|Mail]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JMenu/11.1|JMenu]]&lt;br /&gt;
|[[Subpackage Application/11.1|Application]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JModel/11.1|JModel]]&lt;br /&gt;
|[[Subpackage Application/11.1|Application]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JModelAdmin/11.1|JModelAdmin]]&lt;br /&gt;
|[[Subpackage Application/11.1|Application]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JModelForm/11.1|JModelForm]]&lt;br /&gt;
|[[Subpackage Application/11.1|Application]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JModelItem/11.1|JModelItem]]&lt;br /&gt;
|[[Subpackage Application/11.1|Application]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JModelList/11.1|JModelList]]&lt;br /&gt;
|[[Subpackage Application/11.1|Application]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JModuleHelper/11.1|JModuleHelper]]&lt;br /&gt;
|[[Subpackage Application/11.1|Application]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JNode/11.1|JNode]]&lt;br /&gt;
|[[Subpackage Base/11.1|Base]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JObject/11.1|JObject]]&lt;br /&gt;
|[[Subpackage Base/11.1|Base]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JObservable/11.1|JObservable]]&lt;br /&gt;
|[[Subpackage Base/11.1|Base]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JObserver/11.1|JObserver]]&lt;br /&gt;
|[[Subpackage Base/11.1|Base]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JPackageManifest/11.1|JPackageManifest]]&lt;br /&gt;
|[[Subpackage Installer/11.1|Installer]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JPagination/11.1|JPagination]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JPaginationObject/11.1|JPaginationObject]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JPane/11.1|JPane]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JPaneSliders/11.1|JPaneSliders]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JPaneTabs/11.1|JPaneTabs]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JParameter/11.1|JParameter]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JPath/11.1|JPath]]&lt;br /&gt;
|[[Subpackage Filesystem/11.1|Filesystem]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JPathway/11.1|JPathway]]&lt;br /&gt;
|[[Subpackage Application/11.1|Application]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JPlugin/11.1|JPlugin]]&lt;br /&gt;
|[[Subpackage Plugin/11.1|Plugin]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JPluginHelper/11.1|JPluginHelper]]&lt;br /&gt;
|[[Subpackage Plugin/11.1|Plugin]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JProfiler/11.1|JProfiler]]&lt;br /&gt;
|[[Subpackage Error/11.1|Error]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JRegistry/11.1|JRegistry]]&lt;br /&gt;
|[[Subpackage Registry/11.1|Registry]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JRegistryFormat/11.1|JRegistryFormat]]&lt;br /&gt;
|[[Subpackage Registry/11.1|Registry]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JRegistryFormatIni/11.1|JRegistryFormatIni]]&lt;br /&gt;
|[[Subpackage Registry/11.1|Registry]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JRegistryFormatJson/11.1|JRegistryFormatJson]]&lt;br /&gt;
|[[Subpackage Registry/11.1|Registry]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JRegistryFormatPhp/11.1|JRegistryFormatPhp]]&lt;br /&gt;
|[[Subpackage Registry/11.1|Registry]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JRegistryFormatXml/11.1|JRegistryFormatXml]]&lt;br /&gt;
|[[Subpackage Registry/11.1|Registry]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JRequest/11.1|JRequest]]&lt;br /&gt;
|[[Subpackage Environment/11.1|Environment]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JResponse/11.1|JResponse]]&lt;br /&gt;
|[[Subpackage Environment/11.1|Environment]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JRoute/11.1|JRoute]]&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|[[JRouter/11.1|JRouter]]&lt;br /&gt;
|[[Subpackage Application/11.1|Application]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JRule/11.1|JRule]]&lt;br /&gt;
|[[Subpackage Access/11.1|Access]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JRules/11.1|JRules]]&lt;br /&gt;
|[[Subpackage Access/11.1|Access]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JSession/11.1|JSession]]&lt;br /&gt;
|[[Subpackage Session/11.1|Session]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JSessionStorage/11.1|JSessionStorage]]&lt;br /&gt;
|[[Subpackage Session/11.1|Session]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JSessionStorageApc/11.1|JSessionStorageApc]]&lt;br /&gt;
|[[Subpackage Session/11.1|Session]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JSessionStorageDatabase/11.1|JSessionStorageDatabase]]&lt;br /&gt;
|[[Subpackage Session/11.1|Session]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JSessionStorageEaccelerator/11.1|JSessionStorageEaccelerator]]&lt;br /&gt;
|[[Subpackage Session/11.1|Session]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JSessionStorageMemcache/11.1|JSessionStorageMemcache]]&lt;br /&gt;
|[[Subpackage Session/11.1|Session]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JSessionStorageNone/11.1|JSessionStorageNone]]&lt;br /&gt;
|[[Subpackage Session/11.1|Session]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JSessionStorageWincache/11.1|JSessionStorageWincache]]&lt;br /&gt;
|[[Subpackage Session/11.1|Session]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JSessionStorageXcache/11.1|JSessionStorageXcache]]&lt;br /&gt;
|[[Subpackage Session/11.1|Session]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JSimpleCrypt/11.1|JSimpleCrypt]]&lt;br /&gt;
|[[Subpackage Utilities/11.1|Utilities]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JSimpleXML/11.1|JSimpleXML]]&lt;br /&gt;
|[[Subpackage Utilities/11.1|Utilities]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JSimpleXMLElement/11.1|JSimpleXMLElement]]&lt;br /&gt;
|[[Subpackage Utilities/11.1|Utilities]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JStream/11.1|JStream]]&lt;br /&gt;
|[[Subpackage Filesystem/11.1|Filesystem]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JStreamString/11.1|JStreamString]]&lt;br /&gt;
|[[Subpackage Filesystem/11.1|Filesystem]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JString/11.1|JString]]&lt;br /&gt;
|[[Subpackage Utilities/11.1|Utilities]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JStringController/11.1|JStringController]]&lt;br /&gt;
|[[Subpackage Filesystem/11.1|Filesystem]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JTable/11.1|JTable]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JTableAsset/11.1|JTableAsset]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JTableCategory/11.1|JTableCategory]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JTableContent/11.1|JTableContent]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JTableExtension/11.1|JTableExtension]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JTableLanguage/11.1|JTableLanguage]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JTableMenu/11.1|JTableMenu]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JTableMenuType/11.1|JTableMenuType]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JTableModule/11.1|JTableModule]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JTableNested/11.1|JTableNested]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JTableSession/11.1|JTableSession]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JTableUpdate/11.1|JTableUpdate]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JTableUser/11.1|JTableUser]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JTableUsergroup/11.1|JTableUsergroup]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JTableViewlevel/11.1|JTableViewlevel]]&lt;br /&gt;
|[[Subpackage Database/11.1|Database]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JText/11.1|JText]]&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|[[JToolBar/11.1|JToolBar]]&lt;br /&gt;
|[[Subpackage Html/11.1|Html]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JTree/11.1|JTree]]&lt;br /&gt;
|[[Subpackage Base/11.1|Base]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JUpdate/11.1|JUpdate]]&lt;br /&gt;
|[[Subpackage Updater/11.1|Updater]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JUpdateAdapter/11.1|JUpdateAdapter]]&lt;br /&gt;
|[[Subpackage Updater/11.1|Updater]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JUpdater/11.1|JUpdater]]&lt;br /&gt;
|[[Subpackage Updater/11.1|Updater]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JUpdaterCollection/11.1|JUpdaterCollection]]&lt;br /&gt;
|[[Subpackage Updater/11.1|Updater]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JUpdaterExtension/11.1|JUpdaterExtension]]&lt;br /&gt;
|[[Subpackage Updater/11.1|Updater]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JURI/11.1|JURI]]&lt;br /&gt;
|[[Subpackage Environment/11.1|Environment]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JUser/11.1|JUser]]&lt;br /&gt;
|[[Subpackage User/11.1|User]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JUserHelper/11.1|JUserHelper]]&lt;br /&gt;
|[[Subpackage User/11.1|User]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JUtility/11.1|JUtility]]&lt;br /&gt;
|[[Subpackage Utilities/11.1|Utilities]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JView/11.1|JView]]&lt;br /&gt;
|[[Subpackage Application/11.1|Application]]&lt;br /&gt;
|-&lt;br /&gt;
|[[JXMLElement/11.1|JXMLElement]]&lt;br /&gt;
|[[Subpackage Utilities/11.1|Utilities]]&lt;br /&gt;
|-&lt;br /&gt;
|[[LogException/11.1|LogException]]&lt;br /&gt;
|[[Subpackage Log/11.1|Log]]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;noinclude&amp;gt;== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
[[Category:Platform 11.1]][[Category:Subpackages 11.1]]&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kissaki</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Developing_a_MVC_Component/Adding_a_variable_request_in_the_menu_type&amp;diff=38099</id>
		<title>Archived:Developing a MVC Component/Adding a variable request in the menu type</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Developing_a_MVC_Component/Adding_a_variable_request_in_the_menu_type&amp;diff=38099"/>
		<updated>2011-03-25T16:15:17Z</updated>

		<summary type="html">&lt;p&gt;Kissaki: /* Adding a variable request in the menu type */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial is for {{JVer|1.6}}&lt;br /&gt;
&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
{{Chunk:Developing a Model-View-Controller (MVC) Component for Joomla!1.6 - Contents}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This tutorial is part of the [[Developing a Model-View-Controller (MVC) Component for Joomla!1.6]] tutorial. You are encouraged to read the previous parts of the tutorial before reading this.&lt;br /&gt;
&lt;br /&gt;
== Adding a variable request in the menu type ==&lt;br /&gt;
For the moment, the displayed message is always &#039;&#039;Hello World!&#039;&#039;. Joomla!1.6 gives the possibility to add parameters to menu types. In our case, this is done in the &#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&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;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
				name=&amp;quot;id&amp;quot;&lt;br /&gt;
				type=&amp;quot;list&amp;quot;&lt;br /&gt;
				label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
				description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
				default=&amp;quot;1&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
				&amp;lt;option value=&amp;quot;1&amp;quot;&amp;gt;Hello World!&amp;lt;/option&amp;gt;&lt;br /&gt;
				&amp;lt;option value=&amp;quot;2&amp;quot;&amp;gt;Good bye World!&amp;lt;/option&amp;gt;&lt;br /&gt;
			&amp;lt;/field&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Two important things to note:&lt;br /&gt;
* the &#039;&#039;request&#039;&#039; group of fields indicates mandatory fields&lt;br /&gt;
* &amp;lt;span style=&amp;quot;text-decoration:line-through;&amp;quot;&amp;gt;the &#039;&#039;array&#039;&#039; parameter that indicates that these parameters will be added in the request URL&amp;lt;/span&amp;gt; [??]&amp;lt;!-- What??? Where? --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model has to be modified in order to switch between the two different messages (which is chosen by the user with the field defined above):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;site/models/helloworld.php&#039;&#039;&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 to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
// import Joomla modelitem library&lt;br /&gt;
jimport(&#039;joomla.application.component.modelitem&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var string msg&lt;br /&gt;
	 */&lt;br /&gt;
	protected $msg;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 * @return string The message to be displayed to the user&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg() &lt;br /&gt;
	{&lt;br /&gt;
		if (!isset($this-&amp;gt;msg)) &lt;br /&gt;
		{&lt;br /&gt;
			$id = JRequest::getInt(&#039;id&#039;);&lt;br /&gt;
			switch ($id) &lt;br /&gt;
			{&lt;br /&gt;
			case 2:&lt;br /&gt;
				$this-&amp;gt;msg = &#039;Good bye World!&#039;;&lt;br /&gt;
			break;&lt;br /&gt;
			default:&lt;br /&gt;
			case 1:&lt;br /&gt;
				$this-&amp;gt;msg = &#039;Hello World!&#039;;&lt;br /&gt;
			break;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		return $this-&amp;gt;msg;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also modify your &#039;&#039;helloworld.xml&#039;&#039; file to indicate the new version:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;helloworld.xml&#039;&#039;&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;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting conttraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;November 2009&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.5&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New in 1.6 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&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;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&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;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can test this variable request by putting &#039;&#039;index.php?option=com_helloworld&amp;amp;id=1&#039;&#039; or &#039;&#039;index.php?option=com_helloworld&amp;amp;id=2&#039;&#039; in your browser address.&lt;br /&gt;
&lt;br /&gt;
== Packaging the component ==&lt;br /&gt;
&lt;br /&gt;
Content of your code directory&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_02#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_02#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_04#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_02#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Create a compressed file of this directory or directly download the [http://joomlacode.org/gf/download/frsrelease/11394/58229/com_helloworld-1.6-part05.zip archive] and install it using the extension manager of Joomla!1.6. You can add a menu item of this component using the menu manager in the backend.&lt;br /&gt;
&lt;br /&gt;
== Navigate ==&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller (MVC) Component for Joomla!1.6 - Part 04|Prev: Adding a model to the site part]]&lt;br /&gt;
[[Developing a Model-View-Controller (MVC) Component for Joomla!1.6 - Part 06|Next: Using the database]]&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Manual]]&lt;/div&gt;</summary>
		<author><name>Kissaki</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Developing_a_MVC_Component/Adding_a_variable_request_in_the_menu_type&amp;diff=38098</id>
		<title>Archived:Developing a MVC Component/Adding a variable request in the menu type</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Developing_a_MVC_Component/Adding_a_variable_request_in_the_menu_type&amp;diff=38098"/>
		<updated>2011-03-25T16:13:34Z</updated>

		<summary type="html">&lt;p&gt;Kissaki: /* Adding a variable request in the menu type */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial is for {{JVer|1.6}}&lt;br /&gt;
&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
{{Chunk:Developing a Model-View-Controller (MVC) Component for Joomla!1.6 - Contents}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This tutorial is part of the [[Developing a Model-View-Controller (MVC) Component for Joomla!1.6]] tutorial. You are encouraged to read the previous parts of the tutorial before reading this.&lt;br /&gt;
&lt;br /&gt;
== Adding a variable request in the menu type ==&lt;br /&gt;
For the moment, the displayed message is always &#039;&#039;Hello World!&#039;&#039;. Joomla!1.6 gives the possibility to add parameters to menu types. In our case, this is done in the &#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&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;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
				name=&amp;quot;id&amp;quot;&lt;br /&gt;
				type=&amp;quot;list&amp;quot;&lt;br /&gt;
				label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
				description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
				default=&amp;quot;1&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
				&amp;lt;option value=&amp;quot;1&amp;quot;&amp;gt;Hello World!&amp;lt;/option&amp;gt;&lt;br /&gt;
				&amp;lt;option value=&amp;quot;2&amp;quot;&amp;gt;Good bye World!&amp;lt;/option&amp;gt;&lt;br /&gt;
			&amp;lt;/field&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Two important things to note:&lt;br /&gt;
* the &#039;&#039;request&#039;&#039; group of fields indicates mandatory fields&lt;br /&gt;
* &amp;lt;span style=&amp;quot;text-decoration:line-through;&amp;quot;&amp;gt;the &#039;&#039;array&#039;&#039; parameter that indicates that these parameters will be added in the request URL&amp;lt;/span&amp;gt; [??]&amp;lt;!-- What??? Where? --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model has to be modified in order to switch between the two different messages (which are selected in the field defined above):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;site/models/helloworld.php&#039;&#039;&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 to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
// import Joomla modelitem library&lt;br /&gt;
jimport(&#039;joomla.application.component.modelitem&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var string msg&lt;br /&gt;
	 */&lt;br /&gt;
	protected $msg;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 * @return string The message to be displayed to the user&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg() &lt;br /&gt;
	{&lt;br /&gt;
		if (!isset($this-&amp;gt;msg)) &lt;br /&gt;
		{&lt;br /&gt;
			$id = JRequest::getInt(&#039;id&#039;);&lt;br /&gt;
			switch ($id) &lt;br /&gt;
			{&lt;br /&gt;
			case 2:&lt;br /&gt;
				$this-&amp;gt;msg = &#039;Good bye World!&#039;;&lt;br /&gt;
			break;&lt;br /&gt;
			default:&lt;br /&gt;
			case 1:&lt;br /&gt;
				$this-&amp;gt;msg = &#039;Hello World!&#039;;&lt;br /&gt;
			break;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		return $this-&amp;gt;msg;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also modify your &#039;&#039;helloworld.xml&#039;&#039; file to indicate the new version:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;helloworld.xml&#039;&#039;&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;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting conttraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;November 2009&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.5&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New in 1.6 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&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;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&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;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can test this variable request by putting &#039;&#039;index.php?option=com_helloworld&amp;amp;id=1&#039;&#039; or &#039;&#039;index.php?option=com_helloworld&amp;amp;id=2&#039;&#039; in your browser address.&lt;br /&gt;
&lt;br /&gt;
== Packaging the component ==&lt;br /&gt;
&lt;br /&gt;
Content of your code directory&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_02#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_02#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_04#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_02#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Create a compressed file of this directory or directly download the [http://joomlacode.org/gf/download/frsrelease/11394/58229/com_helloworld-1.6-part05.zip archive] and install it using the extension manager of Joomla!1.6. You can add a menu item of this component using the menu manager in the backend.&lt;br /&gt;
&lt;br /&gt;
== Navigate ==&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller (MVC) Component for Joomla!1.6 - Part 04|Prev: Adding a model to the site part]]&lt;br /&gt;
[[Developing a Model-View-Controller (MVC) Component for Joomla!1.6 - Part 06|Next: Using the database]]&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Manual]]&lt;/div&gt;</summary>
		<author><name>Kissaki</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Developing_a_MVC_Component/Adding_a_variable_request_in_the_menu_type&amp;diff=38097</id>
		<title>Archived:Developing a MVC Component/Adding a variable request in the menu type</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Developing_a_MVC_Component/Adding_a_variable_request_in_the_menu_type&amp;diff=38097"/>
		<updated>2011-03-25T16:11:43Z</updated>

		<summary type="html">&lt;p&gt;Kissaki: /* Adding a variable request in the menu type */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial is for {{JVer|1.6}}&lt;br /&gt;
&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
{{Chunk:Developing a Model-View-Controller (MVC) Component for Joomla!1.6 - Contents}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This tutorial is part of the [[Developing a Model-View-Controller (MVC) Component for Joomla!1.6]] tutorial. You are encouraged to read the previous parts of the tutorial before reading this.&lt;br /&gt;
&lt;br /&gt;
== Adding a variable request in the menu type ==&lt;br /&gt;
For the moment, the displayed message is always &#039;&#039;Hello World!&#039;&#039;. Joomla!1.6 gives the possibility to add parameters to menu types. In our case, this is done in the &#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&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;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
				name=&amp;quot;id&amp;quot;&lt;br /&gt;
				type=&amp;quot;list&amp;quot;&lt;br /&gt;
				label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
				description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
				default=&amp;quot;1&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
				&amp;lt;option value=&amp;quot;1&amp;quot;&amp;gt;Hello World!&amp;lt;/option&amp;gt;&lt;br /&gt;
				&amp;lt;option value=&amp;quot;2&amp;quot;&amp;gt;Good bye World!&amp;lt;/option&amp;gt;&lt;br /&gt;
			&amp;lt;/field&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Two important things to note:&lt;br /&gt;
* the &#039;&#039;request&#039;&#039; group of fields indicates mandatory fields&lt;br /&gt;
* &amp;lt;span style=&amp;quot;text-decoration:line-through;&amp;quot;&amp;gt;the &#039;&#039;array&#039;&#039; parameter that indicates that these parameters will be added in the request URL&amp;lt;/span&amp;gt; [??]&amp;lt;!-- What??? Where? --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model has to be modified in order to choose between the two different messages:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;site/models/helloworld.php&#039;&#039;&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 to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
// import Joomla modelitem library&lt;br /&gt;
jimport(&#039;joomla.application.component.modelitem&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var string msg&lt;br /&gt;
	 */&lt;br /&gt;
	protected $msg;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 * @return string The message to be displayed to the user&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg() &lt;br /&gt;
	{&lt;br /&gt;
		if (!isset($this-&amp;gt;msg)) &lt;br /&gt;
		{&lt;br /&gt;
			$id = JRequest::getInt(&#039;id&#039;);&lt;br /&gt;
			switch ($id) &lt;br /&gt;
			{&lt;br /&gt;
			case 2:&lt;br /&gt;
				$this-&amp;gt;msg = &#039;Good bye World!&#039;;&lt;br /&gt;
			break;&lt;br /&gt;
			default:&lt;br /&gt;
			case 1:&lt;br /&gt;
				$this-&amp;gt;msg = &#039;Hello World!&#039;;&lt;br /&gt;
			break;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		return $this-&amp;gt;msg;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also modify your &#039;&#039;helloworld.xml&#039;&#039; file to indicate the new version:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;helloworld.xml&#039;&#039;&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;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting conttraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;November 2009&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.5&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New in 1.6 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&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;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&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;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can test this variable request by putting &#039;&#039;index.php?option=com_helloworld&amp;amp;id=1&#039;&#039; or &#039;&#039;index.php?option=com_helloworld&amp;amp;id=2&#039;&#039; in your browser address.&lt;br /&gt;
&lt;br /&gt;
== Packaging the component ==&lt;br /&gt;
&lt;br /&gt;
Content of your code directory&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_02#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_02#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_04#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_02#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Create a compressed file of this directory or directly download the [http://joomlacode.org/gf/download/frsrelease/11394/58229/com_helloworld-1.6-part05.zip archive] and install it using the extension manager of Joomla!1.6. You can add a menu item of this component using the menu manager in the backend.&lt;br /&gt;
&lt;br /&gt;
== Navigate ==&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller (MVC) Component for Joomla!1.6 - Part 04|Prev: Adding a model to the site part]]&lt;br /&gt;
[[Developing a Model-View-Controller (MVC) Component for Joomla!1.6 - Part 06|Next: Using the database]]&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Manual]]&lt;/div&gt;</summary>
		<author><name>Kissaki</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Developing_a_MVC_Component/Adding_a_variable_request_in_the_menu_type&amp;diff=38096</id>
		<title>Archived:Developing a MVC Component/Adding a variable request in the menu type</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Developing_a_MVC_Component/Adding_a_variable_request_in_the_menu_type&amp;diff=38096"/>
		<updated>2011-03-25T16:11:22Z</updated>

		<summary type="html">&lt;p&gt;Kissaki: /* Adding a variable request in the menu type */ – PLEASE FIX! I can not find a array anywhere, so this does not seem to fit or belong here!&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial is for {{JVer|1.6}}&lt;br /&gt;
&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
{{Chunk:Developing a Model-View-Controller (MVC) Component for Joomla!1.6 - Contents}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This tutorial is part of the [[Developing a Model-View-Controller (MVC) Component for Joomla!1.6]] tutorial. You are encouraged to read the previous parts of the tutorial before reading this.&lt;br /&gt;
&lt;br /&gt;
== Adding a variable request in the menu type ==&lt;br /&gt;
For the moment, the displayed message is always &#039;&#039;Hello World!&#039;&#039;. Joomla!1.6 gives the possibility to add parameters to menu types. In our case, this is done in the &#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&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;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
				name=&amp;quot;id&amp;quot;&lt;br /&gt;
				type=&amp;quot;list&amp;quot;&lt;br /&gt;
				label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
				description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
				default=&amp;quot;1&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
				&amp;lt;option value=&amp;quot;1&amp;quot;&amp;gt;Hello World!&amp;lt;/option&amp;gt;&lt;br /&gt;
				&amp;lt;option value=&amp;quot;2&amp;quot;&amp;gt;Good bye World!&amp;lt;/option&amp;gt;&lt;br /&gt;
			&amp;lt;/field&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Two important things to note:&lt;br /&gt;
* the &#039;&#039;request&#039;&#039; group of fields indicates mandatory fields&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration:line-through;&amp;quot;&amp;gt;* the &#039;&#039;array&#039;&#039; parameter that indicates that these parameters will be added in the request URL&amp;lt;/span&amp;gt; [??]&amp;lt;!-- What??? Where? --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model has to be modified in order to choose between the two different messages:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;site/models/helloworld.php&#039;&#039;&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 to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
// import Joomla modelitem library&lt;br /&gt;
jimport(&#039;joomla.application.component.modelitem&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var string msg&lt;br /&gt;
	 */&lt;br /&gt;
	protected $msg;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 * @return string The message to be displayed to the user&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg() &lt;br /&gt;
	{&lt;br /&gt;
		if (!isset($this-&amp;gt;msg)) &lt;br /&gt;
		{&lt;br /&gt;
			$id = JRequest::getInt(&#039;id&#039;);&lt;br /&gt;
			switch ($id) &lt;br /&gt;
			{&lt;br /&gt;
			case 2:&lt;br /&gt;
				$this-&amp;gt;msg = &#039;Good bye World!&#039;;&lt;br /&gt;
			break;&lt;br /&gt;
			default:&lt;br /&gt;
			case 1:&lt;br /&gt;
				$this-&amp;gt;msg = &#039;Hello World!&#039;;&lt;br /&gt;
			break;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		return $this-&amp;gt;msg;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also modify your &#039;&#039;helloworld.xml&#039;&#039; file to indicate the new version:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;helloworld.xml&#039;&#039;&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;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting conttraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;November 2009&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.5&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New in 1.6 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&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;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&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;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can test this variable request by putting &#039;&#039;index.php?option=com_helloworld&amp;amp;id=1&#039;&#039; or &#039;&#039;index.php?option=com_helloworld&amp;amp;id=2&#039;&#039; in your browser address.&lt;br /&gt;
&lt;br /&gt;
== Packaging the component ==&lt;br /&gt;
&lt;br /&gt;
Content of your code directory&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_02#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_02#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_04#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_02#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Create a compressed file of this directory or directly download the [http://joomlacode.org/gf/download/frsrelease/11394/58229/com_helloworld-1.6-part05.zip archive] and install it using the extension manager of Joomla!1.6. You can add a menu item of this component using the menu manager in the backend.&lt;br /&gt;
&lt;br /&gt;
== Navigate ==&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller (MVC) Component for Joomla!1.6 - Part 04|Prev: Adding a model to the site part]]&lt;br /&gt;
[[Developing a Model-View-Controller (MVC) Component for Joomla!1.6 - Part 06|Next: Using the database]]&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Manual]]&lt;/div&gt;</summary>
		<author><name>Kissaki</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Version_1.6_Developer_Notes&amp;diff=38095</id>
		<title>Archived:Version 1.6 Developer Notes</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Version_1.6_Developer_Notes&amp;diff=38095"/>
		<updated>2011-03-25T15:32:53Z</updated>

		<summary type="html">&lt;p&gt;Kissaki: /* Changes to XML-RPC support */ fix&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{incomplete}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
&lt;br /&gt;
Compilation of developer notes on changes in 1.6.&lt;br /&gt;
&lt;br /&gt;
== Schema ==&lt;br /&gt;
&lt;br /&gt;
* Added ACL tables (todo - list them)&lt;br /&gt;
* Removed jos_groups table&lt;br /&gt;
* Removed [[Tables/plugins|jos_plugins]] table in favour of [[Tables/extensions|jos_extensions]]&lt;br /&gt;
* Added update tables&lt;br /&gt;
** jos_updates&lt;br /&gt;
** jos_update_sites&lt;br /&gt;
** jos_update_sites_extensions&lt;br /&gt;
** jos_update_categories&lt;br /&gt;
&lt;br /&gt;
== Framework ==&lt;br /&gt;
&lt;br /&gt;
=== JAuthorization ===&lt;br /&gt;
&lt;br /&gt;
Remove &amp;lt;code&amp;gt;JAuthorization::_mos_add_acl&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Added &amp;lt;code&amp;gt;JAuthorization::getUserAccessLevels( $section [, $action = &#039;view&#039;] )&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== JDatabase ===&lt;br /&gt;
&lt;br /&gt;
JDatabase::setQuery casts the sql variable to a string. This allows you to pass an object that implements the __toString magic method.&lt;br /&gt;
&lt;br /&gt;
=== JFile ===&lt;br /&gt;
&lt;br /&gt;
Both JFile::write and JFTP::write now use a reference for its second argument. Code like &#039;&#039;JFile::write($filename,&#039;string&#039;);&#039;&#039; will fail, however &#039;&#039;$data = &#039;string&#039;; JFile::write($filename, $data);&#039;&#039; will work for both 1.5 and 1.6&lt;br /&gt;
&lt;br /&gt;
=== JModel ===&lt;br /&gt;
&lt;br /&gt;
JModel::getState will now take an optional second argument to set the default.&lt;br /&gt;
$value = $model-&amp;gt;getState( &#039;foo&#039;, &#039;bar&#039; );&lt;br /&gt;
&lt;br /&gt;
JModel has an addition contruction option and internal variable &amp;lt;code&amp;gt;__state_set&amp;lt;/code&amp;gt;.  This is used to lazy-load model initialisation.&lt;br /&gt;
&lt;br /&gt;
=== New API ===&lt;br /&gt;
&lt;br /&gt;
Added &amp;lt;code&amp;gt;JTableTree&amp;lt;/code&amp;gt; as an abstract class for tree-based tables.&lt;br /&gt;
&lt;br /&gt;
Made JObject abstract.  It can no longer be directly instantiated.  Use JStdClass instead.&lt;br /&gt;
&lt;br /&gt;
Added &amp;lt;code&amp;gt;JDocumentXML&amp;lt;/code&amp;gt; to allow easy generation of valid XML files.&lt;br /&gt;
&lt;br /&gt;
=== Changes to XML-RPC support ===&lt;br /&gt;
On april the 9th. Louis Landry explained his intended changes to the way Joomla will handle XML-RPC in version 1.6. You can view his detailed explanation [http://docs.joomla.org/Xml-rpc here].&lt;br /&gt;
&lt;br /&gt;
== Components ==&lt;br /&gt;
&lt;br /&gt;
=== Join for access level ===&lt;br /&gt;
&lt;br /&gt;
Before:&lt;br /&gt;
&amp;lt;pre&amp;gt;LEFT JOIN #__groups AS g ON g.id = c.access&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
&amp;lt;pre&amp;gt;LEFT JOIN #__core_acl_axo_groups AS g ON g.value = a.access&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Administrator:Users ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Legacy Mode ==&lt;br /&gt;
&lt;br /&gt;
Only available in legacy mode (to be dropped in future versions):&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;global $mainframe&amp;lt;/code&amp;gt; - Use &amp;lt;code&amp;gt;$app = &amp;amp;JFactory::getApplication()&amp;lt;/code&amp;gt; instead.&lt;br /&gt;
* JTemplate (patTemplate completely deprecated)&lt;br /&gt;
* Multiple client language install packs (e.g. where site and administrator language files are in the same installation file), use packages with two language install packages&lt;br /&gt;
&lt;br /&gt;
== Files/Features Dropped ==&lt;br /&gt;
&lt;br /&gt;
* Support for constants as language strings with JLanguage&lt;br /&gt;
* Polls component&lt;br /&gt;
&lt;br /&gt;
==Templates==&lt;br /&gt;
&lt;br /&gt;
Mapping of positions in Milky Way 1.5 to new positions.&lt;br /&gt;
&lt;br /&gt;
*user3-&amp;gt;position-1&lt;br /&gt;
*breadcrumb-&amp;gt;position-2&lt;br /&gt;
*right-&amp;gt;position-3,position-4&lt;br /&gt;
*left-&amp;gt;position-7&lt;br /&gt;
*user1-&amp;gt;position-9&lt;br /&gt;
*user2-&amp;gt;position-10&lt;br /&gt;
*footer-&amp;gt;position-5,position-8,position-11&lt;br /&gt;
*user4-&amp;gt;position-12&lt;br /&gt;
*syndicate-&amp;gt;position-14&lt;br /&gt;
&lt;br /&gt;
== TODO ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Migration issues ==&lt;br /&gt;
&lt;br /&gt;
Please use [[Version_1.6._Migration_Notes]] to track migration issues that are not schema changes.&lt;/div&gt;</summary>
		<author><name>Kissaki</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J2.5:Supporting_SEF_URLs_in_your_component&amp;diff=38087</id>
		<title>J2.5:Supporting SEF URLs in your component</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J2.5:Supporting_SEF_URLs_in_your_component&amp;diff=38087"/>
		<updated>2011-03-24T13:59:27Z</updated>

		<summary type="html">&lt;p&gt;Kissaki: /* The Component Router */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{incomplete}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
&lt;br /&gt;
== Routing Overview ==&lt;br /&gt;
&lt;br /&gt;
Joomla! 1.5 is capable of creating and parsing URLs in any format, including human readable URL&#039;s. Another improvement is that this still works even if Joomla! runs a server other than Apache with the mod_rewrite module.&lt;br /&gt;
&lt;br /&gt;
A good example of this is the &amp;quot;Welcome to Joomla&amp;quot; article. The first link shown was generated without mod_rewrite, and the second link was generated with mod_rewrite:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://www.example.com/index.php/the-­news/1-­latest­-news/1­-welcome­-to­-joomla&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://www.example.com/the-­news/1­-latest-­news/1-­welcome-­to­-joomla&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Preparing Your Data for Routing ==&lt;br /&gt;
&lt;br /&gt;
=== The Alias ===&lt;br /&gt;
&lt;br /&gt;
The first step is the generation of the so called alias. The alias is used in the URL instead of the title (the title is the text you want to have in the url). The alias has to be URI safe, which means accented UTF­8 characters are replaced by their ASCII­7 equivalents, white spaces by hyphens, etc.&lt;br /&gt;
&lt;br /&gt;
The alias can be defined by the user, but you should ensure that the above requirements for a URL safe alias are met. A good way to do so is to use the JTable::check() method during the save process. Have a look at this example code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function check()&lt;br /&gt;
{&lt;br /&gt;
    jimport( &#039;joomla.filter.output&#039; );&lt;br /&gt;
    if(empty($this-&amp;gt;alias)) {&lt;br /&gt;
	    $this-&amp;gt;alias = $this-&amp;gt;title;&lt;br /&gt;
    }&lt;br /&gt;
    $this-&amp;gt;alias = JFilterOutput::stringURLSafe($this-&amp;gt;alias);&lt;br /&gt;
&lt;br /&gt;
    /* All your other checks */&lt;br /&gt;
    return true;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the alias field is empty the title will be used as alias. Then the alias will be made URLSafe using the JFilterOutput::stringURLSafe() method.&lt;br /&gt;
&lt;br /&gt;
=== The Slug ===&lt;br /&gt;
&lt;br /&gt;
Continuing with the same example, the &amp;quot;slug&amp;quot; - &amp;quot;1­-welcome­-to­-joomla&amp;quot; has two parts. The first part is the article identifier (id) and the second is the alias. They are separated by a colon. These two elements were combined during the database query in the model:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;$query = &#039;SELECT a.*, &#039;.&lt;br /&gt;
         &#039;CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(&amp;quot;:&amp;quot;, a.id, a.alias) ELSE a.id END as slug,&#039;&lt;br /&gt;
         /*...*/;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After this step the slug is used instead of the id.&lt;br /&gt;
&lt;br /&gt;
== Routing URL&#039;s ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;JRoute::_&amp;lt;/code&amp;gt; method translates the internal Joomla! URL to a custom URL. &amp;lt;code&amp;gt;JRoute&amp;lt;/code&amp;gt; has three parameters and its prototype is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;JRoute::_( $url, $xhtml = true, $ssl=null );&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;$url&amp;lt;/code&amp;gt; is a string containing the absolute or relative internal Joomla! URL.&lt;br /&gt;
* &amp;lt;code&amp;gt;$xhtml&amp;lt;/code&amp;gt; is a boolean value that specifies whether or not the output should be in XHTML. This parameter is optional and if omitted defaults to true.&lt;br /&gt;
* &amp;lt;code&amp;gt;$ssl&amp;lt;/code&amp;gt; is an integer value that specifies whether the URI should be secure. It should be set to 1 to force the URI to be secure using the global secure site URI, 0 to leave it in the same state as when it was passed, and -1 to force the URI to be unsecure using the global unsecure site URI.&lt;br /&gt;
&lt;br /&gt;
The most important parameter is &amp;lt;code&amp;gt;$url&amp;lt;/code&amp;gt;. A call to this method might look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;JRoute::_( &#039;index.php?view=article&amp;amp;id=&#039;.$row-&amp;gt;slug );&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$row-­&amp;gt;slug&amp;lt;/code&amp;gt; is the value that was generated in step 2 from a combination of id and title alias.&lt;br /&gt;
&lt;br /&gt;
Another advantage of using JRoute is that the router now handles $option (the component name) and the $Itemid (the menu item ID). The component itself doesn’t have to know its name ($option) or the active menu item ($Itemid) like it did in previous version of Joomla!.&lt;br /&gt;
&lt;br /&gt;
It is important that you think about the sequence of the URL parameter in this stage. This will be more clear when we have a deeper look at the router.php in the next section.&lt;br /&gt;
&lt;br /&gt;
The building process of JRouter is divided into two steps:&lt;br /&gt;
&lt;br /&gt;
* Create the application route. The application route is fully handled by JRouter and the component developer doesn’t have to do anything to make it work.&lt;br /&gt;
* Create the component route. To create the component route, JRouter looks for the router.php in the component directory which is responsible for building the route for the component.&lt;br /&gt;
&lt;br /&gt;
== The Component Router ==&lt;br /&gt;
&lt;br /&gt;
We will have two functions in the router.php. One is responsible for building the URL and the other is responsible for parsing it. In the next examples, a very basic and a more advanced one, we assume that we have three views that links can point to. The first is a categories overview (view=categories), the second is a single category (view=category) and the third is a single article (view=article).&lt;br /&gt;
&lt;br /&gt;
The file router.php should be in the site area of your component. It is not used on admin/backend pages. Don&#039;t forget to add it to your installation XML in the site folder.&lt;br /&gt;
&lt;br /&gt;
=== A Simple Example ===&lt;br /&gt;
&lt;br /&gt;
This simple example will illustrate the basics of implementing a router for your component.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function [componentname]BuildRoute( &amp;amp;$query )&lt;br /&gt;
{&lt;br /&gt;
       $segments = array();&lt;br /&gt;
       if(isset($query[&#039;view&#039;]))&lt;br /&gt;
       {&lt;br /&gt;
                $segments[] = $query[&#039;view&#039;];&lt;br /&gt;
                unset( $query[&#039;view&#039;] );&lt;br /&gt;
       }&lt;br /&gt;
       if(isset($query[&#039;id&#039;]))&lt;br /&gt;
       {&lt;br /&gt;
                $segments[] = $query[&#039;id&#039;];&lt;br /&gt;
                unset( $query[&#039;id&#039;] );&lt;br /&gt;
       };&lt;br /&gt;
       return $segments;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;JRouter&amp;lt;/code&amp;gt; passes a $query array to the &amp;lt;code&amp;gt;[&#039;&#039;componentname&#039;&#039;]BuildRoute&amp;lt;/code&amp;gt; function. This function will add the relevant parts of the array to the $segments array in the right order and will return the properly ordered array. The content of the &amp;lt;code&amp;gt;$query&amp;lt;/code&amp;gt; array needs to be unset, otherwise &amp;lt;code&amp;gt;JRouter&amp;lt;/code&amp;gt; will add it to the URL in the form of a query string (i.e. any variables that are not handled by the router will be passed in the query string).&lt;br /&gt;
&lt;br /&gt;
The prefix &#039;&#039;componentname&#039;&#039; is the name for your component, as found in the directory holding the component&#039;s files. For instance, a component &amp;quot;Magic&amp;quot; in directory &amp;lt;code&amp;gt;/components/com_magic/...&amp;lt;/code&amp;gt; would use a prefix &amp;lt;code&amp;gt;magic&amp;lt;/code&amp;gt; (all lower case).&lt;br /&gt;
&lt;br /&gt;
The next function in the &amp;lt;code&amp;gt;router.php&amp;lt;/code&amp;gt; parses the URL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function [componentname]ParseRoute( $segments )&lt;br /&gt;
{&lt;br /&gt;
       $vars = array();&lt;br /&gt;
       switch($segments[0])&lt;br /&gt;
       {&lt;br /&gt;
               case &#039;categories&#039;:&lt;br /&gt;
                       $vars[&#039;view&#039;] = &#039;categories&#039;;&lt;br /&gt;
                       break;&lt;br /&gt;
               case &#039;category&#039;:&lt;br /&gt;
                       $vars[&#039;view&#039;] = &#039;category&#039;;&lt;br /&gt;
                       $id = explode( &#039;:&#039;, $segments[1] );&lt;br /&gt;
                       $vars[&#039;id&#039;] = (int) $id[0];&lt;br /&gt;
                       break;&lt;br /&gt;
               case &#039;article&#039;:&lt;br /&gt;
                       $vars[&#039;view&#039;] = &#039;article&#039;;&lt;br /&gt;
                       $id = explode( &#039;:&#039;, $segments[1] );&lt;br /&gt;
                       $vars[&#039;id&#039;] = (int) $id[0];&lt;br /&gt;
                       break;&lt;br /&gt;
       }&lt;br /&gt;
       return $vars;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What happens here? In the function &amp;lt;code&amp;gt;[&#039;&#039;componentname&#039;&#039;]BuildRoute&amp;lt;/code&amp;gt; we arranged the items in the &amp;lt;code&amp;gt;$query&amp;lt;/code&amp;gt; array in a specific sequence. This means that in this example the view is first, the catid is second and the id is third in the array.&lt;br /&gt;
&lt;br /&gt;
By reading &amp;lt;code&amp;gt;$segments[0]&amp;lt;/code&amp;gt;, we access the name of the view. We set the right view and/or identifier depending on its value and we return the &amp;lt;code&amp;gt;$vars&amp;lt;/code&amp;gt; array to &amp;lt;code&amp;gt;JRouter&amp;lt;/code&amp;gt;. $vars should be an associative array similar to the array that was passed to the BuildRoute method.&lt;br /&gt;
&lt;br /&gt;
The above example of the &amp;lt;code&amp;gt;router.php&amp;lt;/code&amp;gt; is a very simple way to generate sef URL&#039;s but should show how this works quite clearly.&lt;br /&gt;
&lt;br /&gt;
The generated URL in this example contains the name of the view and doesn&#039;t reflect the content hierarchy:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://www.example.com/[menualias]/[view]/[slug]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== A More Advanced Example ===&lt;br /&gt;
&lt;br /&gt;
In the next example we will try to get rid of the need for the view and we will try to reflect the current hierarchy level in the URL.&lt;br /&gt;
&lt;br /&gt;
The goal is URL&#039;s that look like:&lt;br /&gt;
&lt;br /&gt;
* When viewing an article: &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://www.example.com/[menualias]/[category]/[article]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
* When viewing a category: &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://www.example.com/[menualias]/[category]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
* When viewing the categories overview: &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://www.example.com/[menualias]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&#039;s assume we have done step 1 and 2 also for the category.&lt;br /&gt;
&lt;br /&gt;
The link to the article would look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
JRoute::_( &#039;index.php?view=article&amp;amp;catid=&#039;.$row-­&amp;gt;catslug .&#039;&amp;amp;id=&#039;.$row-­&amp;gt;slug );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the Link to the category would look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
JRoute::_( &#039;index.php?view=category&amp;amp;id=&#039;.$row-&amp;gt;catslug );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corresponding &amp;lt;code&amp;gt;router.php&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function [&#039;&#039;Componentname&#039;&#039;]BuildRoute(&amp;amp;$query)&lt;br /&gt;
{&lt;br /&gt;
       $segments = array();&lt;br /&gt;
       if(isset( $query[&#039;catid&#039;] ))&lt;br /&gt;
       {&lt;br /&gt;
                $segments[] = $query[&#039;catid&#039;];&lt;br /&gt;
                unset( $query[&#039;catid&#039;] );&lt;br /&gt;
       };&lt;br /&gt;
       if( isset($query[&#039;id&#039;]) )&lt;br /&gt;
       {&lt;br /&gt;
                $segments[] = $query[&#039;id&#039;];&lt;br /&gt;
                unset( $query[&#039;id&#039;] );&lt;br /&gt;
       };&lt;br /&gt;
       unset( $query[&#039;view&#039;] );&lt;br /&gt;
       return $segments;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference now is that we don’t add the name of the view to the &amp;lt;code&amp;gt;$segments&amp;lt;/code&amp;gt; array. We still unset the view key since otherwise, &amp;lt;code&amp;gt;JRouter&amp;lt;/code&amp;gt; would add it to the URL as part of the query string. Another new thing here is the additional parameter catid that we push into the &amp;lt;code&amp;gt;$segments&amp;lt;/code&amp;gt; array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function [&#039;&#039;Componentname&#039;&#039;]ParseRoute($segments)&lt;br /&gt;
{&lt;br /&gt;
       $vars = array();&lt;br /&gt;
       $menu =&amp;amp; JMenu::getInstance();&lt;br /&gt;
       $item =&amp;amp; $menu-&amp;gt;getActive();&lt;br /&gt;
       // Count segments&lt;br /&gt;
       $count = count( $segments );&lt;br /&gt;
       //Handle View and Identifier&lt;br /&gt;
       switch( $item-­&amp;gt;query[&#039;view&#039;] )&lt;br /&gt;
       {&lt;br /&gt;
               case &#039;categories&#039;:&lt;br /&gt;
                       if($count == 1) {&lt;br /&gt;
                               $vars[&#039;view&#039;] = &#039;category&#039;;&lt;br /&gt;
                       }&lt;br /&gt;
                       if($count == 2) {&lt;br /&gt;
                               $vars[&#039;view&#039;] = &#039;article&#039;;&lt;br /&gt;
                       }&lt;br /&gt;
                       $id = explode( &#039;:&#039;, $segments[$count-1] );&lt;br /&gt;
                       $vars[&#039;id&#039;] = (int) $id[0];&lt;br /&gt;
                       break;&lt;br /&gt;
               case &#039;category&#039;:&lt;br /&gt;
                       $id   = explode( &#039;:&#039;, $segments[$count-1] );&lt;br /&gt;
                       $vars[&#039;id&#039;]   = (int) $id[0];&lt;br /&gt;
                       $vars[&#039;view&#039;] = &#039;article&#039;;&lt;br /&gt;
                       break;&lt;br /&gt;
       }&lt;br /&gt;
       return $vars;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that this ParseRoute function has a lot of different code parts in comparison to the previous. The reason for this is simple. We don’t have the name of the view in the &amp;lt;code&amp;gt;$segments&amp;lt;/code&amp;gt; array and we need to find another way to determine it.&lt;br /&gt;
&lt;br /&gt;
We need to find out which level of hierarchy we are in by receiving the root element. We do this by looking to the view name of the active menu item:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
$item-­&amp;gt;query[&#039;view&#039;]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also we need to know the number of items in the &amp;lt;code&amp;gt;$segments&amp;lt;/code&amp;gt; array:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
$count = count( $segments );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this information we can correctly set the view for all possible three cases:&lt;br /&gt;
&lt;br /&gt;
* The menu item is a link to the categories view and the &amp;lt;code&amp;gt;$segments&amp;lt;/code&amp;gt; array has two items (&amp;lt;code&amp;gt;$catid&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;$id&amp;lt;/code&amp;gt;). In this case we know that we need to parse a link to an article .&lt;br /&gt;
* The menu item is a link to the categories view and the $segments array has one item ($id). In this case we know that we need to parse a link to a category.&lt;br /&gt;
* The menu item is a link to a category. In this case, we know that any item in the $segments array is the identifier for an article .&lt;br /&gt;
&lt;br /&gt;
The result of all this code is nice and human readable component URL&#039;s.&lt;br /&gt;
&lt;br /&gt;
== Application Route Parsing ==&lt;br /&gt;
&lt;br /&gt;
The [[API Execution Order]] outlines that the route (URL) is parsed immediately after initialisation is complete.  Since fancy URL&#039;s are not treated (yet) in the Administrator, we will follow the route parsing process in detail when &amp;lt;code&amp;gt;JSite::route&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;index.php&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
* Call to &amp;lt;code&amp;gt;JApplication::route&amp;lt;/code&amp;gt;&lt;br /&gt;
** Clone the URI&lt;br /&gt;
** Call to &amp;lt;code&amp;gt;JApplication::getRouter&amp;lt;/code&amp;gt;&lt;br /&gt;
*** Call to &amp;lt;code&amp;gt;JRouter::getInstance&amp;lt;/code&amp;gt; passing the type (&amp;quot;site&amp;quot;)&lt;br /&gt;
** Call to &amp;lt;code&amp;gt;JRouterSite::parse&amp;lt;/code&amp;gt; passing the URI&lt;br /&gt;
*** Strip the suffix if applicable (added to $vars[&#039;format&#039;])&lt;br /&gt;
*** Re-set the route (URI)&lt;br /&gt;
*** Call to &amp;lt;code&amp;gt;JRouter::parse&amp;lt;/code&amp;gt; passing the URI&lt;br /&gt;
**** Call to &amp;lt;code&amp;gt;JRouterSite::_processParseRules&amp;lt;/code&amp;gt; passing the URI (this will call custom route rules)&lt;br /&gt;
***** Call to &amp;lt;code&amp;gt;JRouter::_processParseRules&amp;lt;/code&amp;gt; passing the URI&lt;br /&gt;
****** Call any custom routing rules (probably added via a system plugin using the &amp;lt;code&amp;gt;onAfterInitialise&amp;lt;/code&amp;gt; event trigger) passing the URI&lt;br /&gt;
****** Returns an array of vars&lt;br /&gt;
***** If SEF mode, replace &amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt; variable with &amp;lt;/code&amp;gt;limitstart&amp;lt;/code&amp;gt;&lt;br /&gt;
**** If raw mode, call to &amp;lt;code&amp;gt;JRouterSite::_parseRawRoute&amp;lt;/code&amp;gt; passing the URI&lt;br /&gt;
**** If SEF mode, call to &amp;lt;code&amp;gt;JRouterSite::_parseSefRoute&amp;lt;/code&amp;gt; passing the URI&lt;br /&gt;
***** If the route (the URI path) is empty, load it from the default menu item; set the active menu item as the default&lt;br /&gt;
***** If first part is &amp;lt;code&amp;gt;/component/com_content&amp;lt;/code&amp;gt;, set the &amp;lt;code&amp;gt;option&amp;lt;/code&amp;gt; as the second segement.  Null the &amp;lt;code&amp;gt;Itemid&amp;lt;/code&amp;gt;.&lt;br /&gt;
***** Else, loop through menu alias values and take off segments that match as the menu tree is traversed.  Set &amp;lt;code&amp;gt;option&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;Itemid&amp;lt;/code&amp;gt; based on the last menu item found.&lt;br /&gt;
***** If the &amp;lt;code&amp;gt;Itemid&amp;lt;/code&amp;gt; is set in the URL, set the active menu item based on this value.&lt;br /&gt;
***** Push the vars collected so far (eg, &amp;lt;code&amp;gt;option&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Itemid&amp;lt;/code&amp;gt;, etc) into the router object (&amp;lt;code&amp;gt;$this&amp;lt;/code&amp;gt;).&lt;br /&gt;
***** If the route and &amp;lt;code&amp;gt;option&amp;lt;/code&amp;gt; is set, load the component router;&lt;br /&gt;
***** Else, get the active menu item and get the route vars from it&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Application Route Building ==&lt;br /&gt;
&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
== Custom Router Rules ==&lt;br /&gt;
&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
== Additional References ==&lt;br /&gt;
&lt;br /&gt;
There is a useful thread on this subject here: [[jtopic:148632]] (note, may be out of date)&lt;/div&gt;</summary>
		<author><name>Kissaki</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Developing_a_MVC_Component/Adding_a_variable_request_in_the_menu_type&amp;diff=37955</id>
		<title>Archived:Developing a MVC Component/Adding a variable request in the menu type</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Developing_a_MVC_Component/Adding_a_variable_request_in_the_menu_type&amp;diff=37955"/>
		<updated>2011-03-10T18:07:04Z</updated>

		<summary type="html">&lt;p&gt;Kissaki: /* Adding a variable request in the menu type */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial is for {{JVer|1.6}}&lt;br /&gt;
&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
{{Chunk:Developing a Model-View-Controller (MVC) Component for Joomla!1.6 - Contents}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This tutorial is part of the [[Developing a Model-View-Controller (MVC) Component for Joomla!1.6]] tutorial. You are encouraged to read the previous parts of the tutorial before reading this.&lt;br /&gt;
&lt;br /&gt;
== Adding a variable request in the menu type ==&lt;br /&gt;
For the moment, the displayed message is always &#039;&#039;Hello World!&#039;&#039;. Joomla!1.6 gives the possibility to add parameters to menu types. In our case, this is done in the &#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&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;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
				name=&amp;quot;id&amp;quot;&lt;br /&gt;
				type=&amp;quot;list&amp;quot;&lt;br /&gt;
				label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
				description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
				default=&amp;quot;1&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
				&amp;lt;option value=&amp;quot;1&amp;quot;&amp;gt;Hello World!&amp;lt;/option&amp;gt;&lt;br /&gt;
				&amp;lt;option value=&amp;quot;2&amp;quot;&amp;gt;Good bye World!&amp;lt;/option&amp;gt;&lt;br /&gt;
			&amp;lt;/field&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Two important things to note:&lt;br /&gt;
* the &#039;&#039;request&#039;&#039; group of fields indicates mandatory fields&lt;br /&gt;
* the &#039;&#039;array&#039;&#039; parameter that indicates that these parameters will be added in the request URL&amp;lt;!-- What??? Where? --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model has to be modified in order to choose between the two different messages:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;site/models/helloworld.php&#039;&#039;&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 to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
// import Joomla modelitem library&lt;br /&gt;
jimport(&#039;joomla.application.component.modelitem&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var string msg&lt;br /&gt;
	 */&lt;br /&gt;
	protected $msg;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 * @return string The message to be displayed to the user&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg() &lt;br /&gt;
	{&lt;br /&gt;
		if (!isset($this-&amp;gt;msg)) &lt;br /&gt;
		{&lt;br /&gt;
			$id = JRequest::getInt(&#039;id&#039;);&lt;br /&gt;
			switch ($id) &lt;br /&gt;
			{&lt;br /&gt;
			case 2:&lt;br /&gt;
				$this-&amp;gt;msg = &#039;Good bye World!&#039;;&lt;br /&gt;
			break;&lt;br /&gt;
			default:&lt;br /&gt;
			case 1:&lt;br /&gt;
				$this-&amp;gt;msg = &#039;Hello World!&#039;;&lt;br /&gt;
			break;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		return $this-&amp;gt;msg;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also modify your &#039;&#039;helloworld.xml&#039;&#039; file to indicate the new version:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;helloworld.xml&#039;&#039;&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;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting conttraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;November 2009&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.5&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New in 1.6 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&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;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&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;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can test this variable request by putting &#039;&#039;index.php?option=com_helloworld&amp;amp;id=1&#039;&#039; or &#039;&#039;index.php?option=com_helloworld&amp;amp;id=2&#039;&#039; in your browser address.&lt;br /&gt;
&lt;br /&gt;
== Packaging the component ==&lt;br /&gt;
&lt;br /&gt;
Content of your code directory&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_02#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_02#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_04#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_02#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Create a compressed file of this directory or directly download the [http://joomlacode.org/gf/download/frsrelease/11394/58229/com_helloworld-1.6-part05.zip archive] and install it using the extension manager of Joomla!1.6. You can add a menu item of this component using the menu manager in the backend.&lt;br /&gt;
&lt;br /&gt;
== Navigate ==&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller (MVC) Component for Joomla!1.6 - Part 04|Prev: Adding a model to the site part]]&lt;br /&gt;
[[Developing a Model-View-Controller (MVC) Component for Joomla!1.6 - Part 06|Next: Using the database]]&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Manual]]&lt;/div&gt;</summary>
		<author><name>Kissaki</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Developing_a_MVC_Component/Adding_a_variable_request_in_the_menu_type&amp;diff=37952</id>
		<title>Archived:Developing a MVC Component/Adding a variable request in the menu type</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Developing_a_MVC_Component/Adding_a_variable_request_in_the_menu_type&amp;diff=37952"/>
		<updated>2011-03-10T18:04:31Z</updated>

		<summary type="html">&lt;p&gt;Kissaki: /* Adding a variable request in the menu type */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial is for {{JVer|1.6}}&lt;br /&gt;
&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
{{Chunk:Developing a Model-View-Controller (MVC) Component for Joomla!1.6 - Contents}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This tutorial is part of the [[Developing a Model-View-Controller (MVC) Component for Joomla!1.6]] tutorial. You are encouraged to read the previous parts of the tutorial before reading this.&lt;br /&gt;
&lt;br /&gt;
== Adding a variable request in the menu type ==&lt;br /&gt;
For the moment, the displayed message is always &#039;&#039;Hello World!&#039;&#039;. Joomla!1.6 gives the possibility to add parameters to menu types. In our case, this is done in the &#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&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;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
				name=&amp;quot;id&amp;quot;&lt;br /&gt;
				type=&amp;quot;list&amp;quot;&lt;br /&gt;
				label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
				description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
				default=&amp;quot;1&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
				&amp;lt;option value=&amp;quot;1&amp;quot;&amp;gt;Hello World!&amp;lt;/option&amp;gt;&lt;br /&gt;
				&amp;lt;option value=&amp;quot;2&amp;quot;&amp;gt;Good bye World!&amp;lt;/option&amp;gt;&lt;br /&gt;
			&amp;lt;/field&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note two important information:&lt;br /&gt;
* the &#039;&#039;request&#039;&#039; group of fields indicates mandatory fields&lt;br /&gt;
* the &#039;&#039;array&#039;&#039; parameter that indicates that these parameters will be added in the request URL&lt;br /&gt;
&lt;br /&gt;
The model has to be modified in order to choose between the two different messages:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;site/models/helloworld.php&#039;&#039;&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 to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
// import Joomla modelitem library&lt;br /&gt;
jimport(&#039;joomla.application.component.modelitem&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var string msg&lt;br /&gt;
	 */&lt;br /&gt;
	protected $msg;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 * @return string The message to be displayed to the user&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg() &lt;br /&gt;
	{&lt;br /&gt;
		if (!isset($this-&amp;gt;msg)) &lt;br /&gt;
		{&lt;br /&gt;
			$id = JRequest::getInt(&#039;id&#039;);&lt;br /&gt;
			switch ($id) &lt;br /&gt;
			{&lt;br /&gt;
			case 2:&lt;br /&gt;
				$this-&amp;gt;msg = &#039;Good bye World!&#039;;&lt;br /&gt;
			break;&lt;br /&gt;
			default:&lt;br /&gt;
			case 1:&lt;br /&gt;
				$this-&amp;gt;msg = &#039;Hello World!&#039;;&lt;br /&gt;
			break;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		return $this-&amp;gt;msg;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also modify your &#039;&#039;helloworld.xml&#039;&#039; file to indicate the new version:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;helloworld.xml&#039;&#039;&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;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting conttraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;November 2009&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.5&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New in 1.6 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&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;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&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;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can test this variable request by putting &#039;&#039;index.php?option=com_helloworld&amp;amp;id=1&#039;&#039; or &#039;&#039;index.php?option=com_helloworld&amp;amp;id=2&#039;&#039; in your browser address.&lt;br /&gt;
&lt;br /&gt;
== Packaging the component ==&lt;br /&gt;
&lt;br /&gt;
Content of your code directory&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_02#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_02#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_04#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_02#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Create a compressed file of this directory or directly download the [http://joomlacode.org/gf/download/frsrelease/11394/58229/com_helloworld-1.6-part05.zip archive] and install it using the extension manager of Joomla!1.6. You can add a menu item of this component using the menu manager in the backend.&lt;br /&gt;
&lt;br /&gt;
== Navigate ==&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller (MVC) Component for Joomla!1.6 - Part 04|Prev: Adding a model to the site part]]&lt;br /&gt;
[[Developing a Model-View-Controller (MVC) Component for Joomla!1.6 - Part 06|Next: Using the database]]&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Manual]]&lt;/div&gt;</summary>
		<author><name>Kissaki</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Developing_a_MVC_Component/Adding_a_view_to_the_site_part&amp;diff=37945</id>
		<title>Archived:Developing a MVC Component/Adding a view to the site part</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Developing_a_MVC_Component/Adding_a_view_to_the_site_part&amp;diff=37945"/>
		<updated>2011-03-10T17:30:36Z</updated>

		<summary type="html">&lt;p&gt;Kissaki: /* Setting the view */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial is for {{JVer|1.6}}&lt;br /&gt;
&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
{{Chunk:Developing a Model-View-Controller (MVC) Component for Joomla!1.6 - Contents}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This tutorial is part of the [[Developing a Model-View-Controller (MVC) Component for Joomla!1.6]] tutorial. You are encouraged to read the previous parts of the tutorial before reading this.&lt;br /&gt;
&lt;br /&gt;
In the Joomla!1.6 framework, third party components authors divide their code into three main parts:&lt;br /&gt;
* &#039;&#039;models&#039;&#039; They manage the data &lt;br /&gt;
* &#039;&#039;controllers&#039;&#039; They perform tasks, set and get the states of the models and ask the views to display&lt;br /&gt;
* &#039;&#039;views&#039;&#039; They display the content according to the type (&#039;&#039;error&#039;&#039;, &#039;&#039;feed&#039;&#039;, &#039;&#039;html&#039;&#039;, &#039;&#039;json&#039;&#039;, &#039;&#039;raw&#039;&#039;, &#039;&#039;xml&#039;&#039;) and the layout chosen by the controllers&lt;br /&gt;
&lt;br /&gt;
== Setting the controller ==&lt;br /&gt;
In the core code of Joomla, there is a class able to manage controllers: &#039;&#039;JController&#039;&#039;. This class has to be extended to be used in our component. In the file &#039;&#039;site/helloworld.php&#039;&#039; (entry point of our &#039;&#039;Hello World&#039;&#039; component), put these lines&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;site/helloworld.php&#039;&#039;&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 to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
// import joomla controller library&lt;br /&gt;
jimport(&#039;joomla.application.component.controller&#039;);&lt;br /&gt;
&lt;br /&gt;
// Get an instance of the controller prefixed by HelloWorld&lt;br /&gt;
$controller = JController::getInstance(&#039;HelloWorld&#039;);&lt;br /&gt;
&lt;br /&gt;
// Perform the Request task&lt;br /&gt;
$controller-&amp;gt;execute(JRequest::getCmd(&#039;task&#039;));&lt;br /&gt;
&lt;br /&gt;
// Redirect if set by the controller&lt;br /&gt;
$controller-&amp;gt;redirect();&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
The &#039;&#039;getInstance&#039;&#039; static method of the &#039;&#039;JController&#039;&#039; class will create a controller. In the code above, it will create a controller named &#039;&#039;HelloWorldController&#039;&#039; using the &#039;&#039;controller.php&#039;&#039; file (it&#039;s a default behavior)&lt;br /&gt;
&lt;br /&gt;
With your favorite file manager and editor, create a &#039;&#039;site/controller.php&#039;&#039; file containing&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/controller.php&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;site/controller.php&#039;&#039;&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 to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
// import Joomla controller library&lt;br /&gt;
jimport(&#039;joomla.application.component.controller&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello World Component Controller&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldController extends JController&lt;br /&gt;
{&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When no task is given in the request variables, the default task will be executed. It&#039;s the &#039;&#039;display&#039;&#039; task by default. The &#039;&#039;JController&#039;&#039; class has such a task. In our example, it will display a view named &#039;&#039;HelloWorld&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Setting the view ==&lt;br /&gt;
With your favorite file manager and editor, create a file &#039;&#039;site/views/helloworld/view.html.php&#039;&#039; able to display the default view and containing&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/view.html.php&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;site/views/helloworld/view.html.php&#039;&#039;&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 to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
// import Joomla view library&lt;br /&gt;
jimport(&#039;joomla.application.component.view&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HTML View class for the HelloWorld Component&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldViewHelloWorld extends JView&lt;br /&gt;
{&lt;br /&gt;
	// Overwriting JView display method&lt;br /&gt;
	function display($tpl = null) &lt;br /&gt;
	{&lt;br /&gt;
		// Assign data to the view&lt;br /&gt;
		$this-&amp;gt;msg = &#039;Hello World&#039;;&lt;br /&gt;
&lt;br /&gt;
		// Display the view&lt;br /&gt;
		parent::display($tpl);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;display&#039;&#039; method of the &#039;&#039;JView&#039;&#039; class is called with the &#039;&#039;display&#039;&#039; task of the JController class. In our case, this method will display data using the &#039;&#039;tmpl/default.php&#039;&#039; file. With your favorite file manager and editor, create a file &#039;&#039;site/views/helloworld/tmpl/default.php&#039;&#039; able to display the default view and containing&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.php&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;site/views/helloworld/tmpl/default.php&#039;&#039;&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 to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;h1&amp;gt;&amp;lt;?php echo $this-&amp;gt;msg; ?&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This template file will be included by the JView class. Therefore, here, $this refers to the HelloWorldViewHelloWorld class.&lt;br /&gt;
&lt;br /&gt;
== Packaging the component ==&lt;br /&gt;
&lt;br /&gt;
Content of your code directory&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.6_-_Part_01#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Create a compressed file of this directory or directly download the [http://joomlacode.org/gf/download/frsrelease/11394/58226/com_helloworld-1.6-part02.zip archive] and install it using the extension manager of Joomla!1.6. You can test this basic component by putting &#039;&#039;index.php?option=com_helloworld&#039;&#039; in your browser address.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;helloworld.xml&#039;&#039;&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;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting conttraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;November 2009&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.2&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New in 1.6 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&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;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&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;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Result:&#039;&#039;&#039;&lt;br /&gt;
You will see by default the message contained in the variable &#039;&#039;$this-&amp;gt;msg&#039;&#039; in the &#039;&#039;view.html.php&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
== Navigate ==&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller (MVC) Component for Joomla!1.6 - Part 01|Prev: Developing a Basic Component]] [[Developing a Model-View-Controller (MVC) Component for Joomla!1.6 - Part 03|Next: Adding a menu type to the site part]]&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Manual]]&lt;/div&gt;</summary>
		<author><name>Kissaki</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Joomla_1.6_version_history&amp;diff=37082</id>
		<title>Joomla 1.6 version history</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Joomla_1.6_version_history&amp;diff=37082"/>
		<updated>2011-02-11T17:37:46Z</updated>

		<summary type="html">&lt;p&gt;Kissaki: 1.6 has been released …&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{RightTOC}}&lt;br /&gt;
&lt;br /&gt;
== Joomla! 1.6.0 ==&lt;br /&gt;
* Onward&lt;br /&gt;
* 10 January 2011&lt;br /&gt;
* [http://www.joomla.org/announcements/general-news/5348-joomlar-16-has-arrived.html Release Notes]&lt;br /&gt;
* [http://joomlacode.org/gf/project/joomla/frs/?action=FrsReleaseBrowse&amp;amp;frs_package_id=5696 Package and MD5s]&lt;br /&gt;
&lt;br /&gt;
== Joomla! 1.6 Release Candidate 1 ==&lt;br /&gt;
* 14 December 2010&lt;br /&gt;
* [http://www.joomla.org/announcements/release-news/5328-joomla-16-rc1-now-available.html Release Notes]&lt;br /&gt;
* [http://joomlacode.org/gf/project/joomla/frs/?action=FrsReleaseBrowse&amp;amp;frs_package_id=5560 Package and MD5s]&lt;br /&gt;
&lt;br /&gt;
== Joomla! 1.6 Beta 15 ==&lt;br /&gt;
* 29 November 2010&lt;br /&gt;
* [http://www.joomla.org/announcements/release-news/5324-joomla-16-beta15-now-available.html Release Notes]&lt;br /&gt;
* [http://joomlacode.org/gf/project/joomla/frs/?action=FrsReleaseBrowse&amp;amp;frs_package_id=5539 Package and MD5s]&lt;br /&gt;
&lt;br /&gt;
== Joomla! 1.6 Beta 14 ==&lt;br /&gt;
* 15 November 2010&lt;br /&gt;
* [http://www.joomla.org/announcements/release-news/5320-joomla-16-beta14-now-available.html Release Notes]&lt;br /&gt;
* [http://joomlacode.org/gf/project/joomla/frs/?action=FrsReleaseBrowse&amp;amp;frs_package_id=5523 Package and MD5s]&lt;br /&gt;
&lt;br /&gt;
== Joomla! 1.6 Beta 13 ==&lt;br /&gt;
* 1 November 2010&lt;br /&gt;
* [http://www.joomla.org/announcements/release-news/5315-joomla-16-beta13-now-available.html Release Notes]&lt;br /&gt;
* [http://joomlacode.org/gf/project/joomla/frs/?action=FrsReleaseBrowse&amp;amp;frs_package_id=5496 Package and MD5s]&lt;br /&gt;
&lt;br /&gt;
== Joomla! 1.6 Beta 12 ==&lt;br /&gt;
* 18 October 2010&lt;br /&gt;
* [http://www.joomla.org/announcements/release-news/5304-joomla-16-beta12-now-available.html Release Notes]&lt;br /&gt;
* [http://joomlacode.org/gf/project/joomla/frs/?action=FrsReleaseBrowse&amp;amp;frs_package_id=5480 Package and MD5s]&lt;br /&gt;
&lt;br /&gt;
== Joomla! 1.6 Beta 11 ==&lt;br /&gt;
* 4 October 2010&lt;br /&gt;
* [http://www.joomla.org/announcements/release-news/5296-joomla-16-beta11-now-available.html Release Notes]&lt;br /&gt;
* [http://joomlacode.org/gf/project/joomla/frs/?action=FrsReleaseBrowse&amp;amp;frs_package_id=5448 Package and MD5s]&lt;br /&gt;
&lt;br /&gt;
== Joomla! 1.6 Beta 10 ==&lt;br /&gt;
* 20 September 2010&lt;br /&gt;
* [http://www.joomla.org/announcements/release-news/5295-joomla-16-beta10-now-available.html Release Notes]&lt;br /&gt;
* [http://joomlacode.org/gf/project/joomla/frs/?action=FrsReleaseBrowse&amp;amp;frs_package_id=5426 Package and MD5s]&lt;br /&gt;
&lt;br /&gt;
== Joomla! 1.6 Beta 9 ==&lt;br /&gt;
* 7 September 2010&lt;br /&gt;
* [http://www.joomla.org/announcements/release-news/5294-joomla-16-beta9-now-available.html Release Notes]&lt;br /&gt;
* [http://joomlacode.org/gf/project/joomla/frs/?action=FrsReleaseBrowse&amp;amp;frs_package_id=5398 Package and MD5s]&lt;br /&gt;
&lt;br /&gt;
== Joomla! 1.6 Beta 8 ==&lt;br /&gt;
* 23 August 2010&lt;br /&gt;
* [http://www.joomla.org/announcements/release-news/5292-joomla-16-beta8-now-available.html Release Notes]&lt;br /&gt;
* [http://joomlacode.org/gf/project/joomla/frs/?action=FrsReleaseBrowse&amp;amp;frs_package_id=5378 Package and MD5s]&lt;br /&gt;
&lt;br /&gt;
== Joomla! 1.6 Beta 7 ==&lt;br /&gt;
* 9 August 2010&lt;br /&gt;
* [http://www.joomla.org/announcements/release-news/5291-joomla-16-beta7-now-available.html Release Notes]&lt;br /&gt;
* [http://joomlacode.org/gf/project/joomla/frs/?action=FrsReleaseBrowse&amp;amp;frs_package_id=5364 Package and MD5s]&lt;br /&gt;
&lt;br /&gt;
== Joomla! 1.6 Beta 6 ==&lt;br /&gt;
* 26 July 2010&lt;br /&gt;
* [http://www.joomla.org/announcements/release-news/5285-joomla-16-beta6-now-available.html Release Notes]&lt;br /&gt;
* [http://joomlacode.org/gf/project/joomla/frs/?action=FrsReleaseBrowse&amp;amp;frs_package_id=5346 Package and MD5s]&lt;br /&gt;
&lt;br /&gt;
== Joomla! 1.6 Beta 5 ==&lt;br /&gt;
* 12 July 2010&lt;br /&gt;
* [http://www.joomla.org/announcements/release-news/5282-joomla-16-beta5-now-available.html Release Notes]&lt;br /&gt;
* [http://joomlacode.org/gf/project/joomla/frs/?action=FrsReleaseBrowse&amp;amp;frs_package_id=5314 Package and MD5s]&lt;br /&gt;
&lt;br /&gt;
== Joomla! 1.6 Beta 4 ==&lt;br /&gt;
* 28 June 2010&lt;br /&gt;
* [http://www.joomla.org/announcements/release-news/5280-joomla-16-beta4-now-available.html Release Notes]&lt;br /&gt;
* [http://joomlacode.org/gf/project/joomla/frs/?action=FrsReleaseBrowse&amp;amp;frs_package_id=5300 Package and MD5s]&lt;br /&gt;
&lt;br /&gt;
== Joomla! 1.6 Beta 3 ==&lt;br /&gt;
* 14 June 2010&lt;br /&gt;
* [http://www.joomla.org/announcements/release-news/5279-joomla-16-beta3-now-available.html Release Notes]&lt;br /&gt;
* [http://joomlacode.org/gf/project/joomla/frs/?action=FrsReleaseBrowse&amp;amp;frs_package_id=5276 Package and MD5s]&lt;br /&gt;
&lt;br /&gt;
== Joomla! 1.6 Beta 2 ==&lt;br /&gt;
* 31 May 2010&lt;br /&gt;
* [http://www.joomla.org/announcements/release-news/5278-joomla-16-beta2-now-available.html Release Notes]&lt;br /&gt;
* [http://joomlacode.org/gf/project/joomla/frs/?action=FrsReleaseBrowse&amp;amp;frs_package_id=5249 Package and MD5s]&lt;br /&gt;
&lt;br /&gt;
== Joomla! 1.6 Beta 1 ==&lt;br /&gt;
* 18 May 2010&lt;br /&gt;
* [http://www.joomla.org/announcements/release-news/5275-joomla-16-beta-now-available.html Release Notes]&lt;br /&gt;
* [http://joomlacode.org/gf/project/joomla/frs/?action=FrsReleaseBrowse&amp;amp;frs_package_id=5224 Package and MD5s]&lt;br /&gt;
&lt;br /&gt;
== Joomla! 1.6 Alpha 2 ==&lt;br /&gt;
* 24 October 2009&lt;br /&gt;
* [http://community.joomla.org/blogs/community/1061-joomla-16-alpha-2-released.html Release Notes]&lt;br /&gt;
* [http://joomlacode.org/gf/project/joomla/frs/?action=FrsReleaseBrowse&amp;amp;frs_package_id=3585 Package and MD5s]&lt;br /&gt;
&lt;br /&gt;
== Joomla! 1.6 Alpha ==&lt;br /&gt;
* 22 April 2009&lt;br /&gt;
* Release Notes&lt;br /&gt;
* [http://joomlacode.org/gf/project/joomla/frs/?action=FrsReleaseBrowse&amp;amp;frs_package_id=3585 Package and MD5s]&lt;br /&gt;
&lt;br /&gt;
== Joomla! 1.6.x Change Log ==&lt;br /&gt;
For any Joomla! 1.6 release, use [http://joomlacode.org/gf/project/joomla/scmsvn/?action=browse&amp;amp;path=%2Fdevelopment%2Ftrunk%2Finstallation%2FCHANGELOG&amp;amp;view=markup this Change Log]&lt;br /&gt;
&lt;br /&gt;
== To locate the MD5 Hash ==&lt;br /&gt;
# Click the link for &#039;&#039;&#039;Packages and MD5s&#039;&#039;&#039; above for the version desired.&lt;br /&gt;
# Click the word &#039;&#039;&#039;Files&#039;&#039;&#039; in the blue bar to expand the list of patch packages available.&lt;br /&gt;
# Locate the row that matches your current installation version.&lt;br /&gt;
# On that row, select the patch package (zip, tar.gz and tar.bz2) that is most convenient for you.&lt;br /&gt;
# Verify the download using the MD5 hash listed in the right column on the same line as the package you selected.&lt;br /&gt;
&lt;br /&gt;
[[Category:Joomla! 1.6]]&lt;/div&gt;</summary>
		<author><name>Kissaki</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J2.5:What%27s_new_in_Joomla_2.5&amp;diff=30771</id>
		<title>J2.5:What&#039;s new in Joomla 2.5</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J2.5:What%27s_new_in_Joomla_2.5&amp;diff=30771"/>
		<updated>2010-09-18T19:48:12Z</updated>

		<summary type="html">&lt;p&gt;Kissaki: /* Banners list */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Lots of things.&lt;br /&gt;
&lt;br /&gt;
...and:&lt;br /&gt;
* &#039;&#039;&#039;New Access Control System&#039;&#039;&#039; - Allows site administrators control over who can view and manage content.&lt;br /&gt;
* &#039;&#039;&#039;Unlimited Depth Organizational Model&#039;&#039;&#039; - Gives site administrators and content creators user-defined category levels that allow for the creation of a category tree with as many or as few levels for organizing articles and other content as needed.&lt;br /&gt;
* &#039;&#039;&#039;One-Click Extension Updates&#039;&#039;&#039; - Allows users to keep sites secure and controlled by simplifying the process of updating extensions.&lt;br /&gt;
* &#039;&#039;&#039;Semantic XHTML Layouts&#039;&#039;&#039; - Provides a better baseline for content presentation.&lt;br /&gt;
&lt;br /&gt;
...and:&lt;br /&gt;
&lt;br /&gt;
==Administrators==&lt;br /&gt;
===Introduction===&lt;br /&gt;
*Consistent UI&lt;br /&gt;
*Consistent Features&lt;br /&gt;
*Richer sample data&lt;br /&gt;
*IE 7+, Firefox 3.x, Safari 4.x&lt;br /&gt;
*PHP 5.2.4+&lt;br /&gt;
*MySQL 5.0.4 (allows for wide varchars)&lt;br /&gt;
&lt;br /&gt;
===Administrator===&lt;br /&gt;
*Menu Changes&lt;br /&gt;
*Submenu consistency&lt;br /&gt;
&lt;br /&gt;
====Toolbar Features====&lt;br /&gt;
*Save&lt;br /&gt;
*Save &amp;amp; Close&lt;br /&gt;
*Save &amp;amp; New&lt;br /&gt;
*Save as Copy&lt;br /&gt;
*Expired session will return to the page you were on then you got logged out (can be hit and miss)&lt;br /&gt;
*Most search filters allow you to search for a record id via [ id:123 ]&lt;br /&gt;
*&amp;quot;Parameters&amp;quot; are now referred to as &amp;quot;Options&amp;quot;&lt;br /&gt;
*Template Styles&lt;br /&gt;
*Integrated Trash Management&lt;br /&gt;
*Consistent archive support for most content&lt;br /&gt;
*Extension Installer Improvements&lt;br /&gt;
&lt;br /&gt;
===Module Enhancements===&lt;br /&gt;
*Publish up and down&lt;br /&gt;
*Add option to display on all pages &amp;quot;except&amp;quot; selected&lt;br /&gt;
*Expanded Category System&lt;br /&gt;
*404 Page Redirection&lt;br /&gt;
*Better Menu Management&lt;br /&gt;
*Alternative layouts for content, modules and menus (taken from the home template)&lt;br /&gt;
&lt;br /&gt;
===New Templates===&lt;br /&gt;
*Atomic&lt;br /&gt;
*Beez2&lt;br /&gt;
*(Administrator) Bluestork (replaces Khephri)&lt;br /&gt;
*(Administrator) Hathor&lt;br /&gt;
*Legacy layer in Milkyway&lt;br /&gt;
*Backend supports layout overrides&lt;br /&gt;
*New Modules&lt;br /&gt;
*New Plugins&lt;br /&gt;
*Content Languages&lt;br /&gt;
*User Login Permissions&lt;br /&gt;
*Activate selected users from the user list now (and filter)&lt;br /&gt;
*Administrator registration approval&lt;br /&gt;
*Polls component removed&lt;br /&gt;
*New codemirror editor&lt;br /&gt;
&lt;br /&gt;
===SEO Improvements===&lt;br /&gt;
*Meta decription and keywords for categories&lt;br /&gt;
*Articles can change the page title and page header separately&lt;br /&gt;
&lt;br /&gt;
===Global Configuration===&lt;br /&gt;
*Add site name to titles&lt;br /&gt;
*Default Access Level&lt;br /&gt;
*Set Metadata Language (buggy)&lt;br /&gt;
*Unicode Aliases&lt;br /&gt;
*Cookie domain and path&lt;br /&gt;
*User Setting moved to User Manager -&amp;gt; Options&lt;br /&gt;
*Media Settings moved to Media Manager -&amp;gt; Options&lt;br /&gt;
*Debug Modules - allows you to enabled to disable the tp=1 feature&lt;br /&gt;
*Server Timezone now a location, not an integer offset&lt;br /&gt;
*New Global Permissions tab&lt;br /&gt;
&lt;br /&gt;
===User Manager===&lt;br /&gt;
*Can activate a user from the list now&lt;br /&gt;
*User can be assigned to multiple groups&lt;br /&gt;
*Manage user groups&lt;br /&gt;
*Manager content access levels&lt;br /&gt;
&lt;br /&gt;
===Media Manager===&lt;br /&gt;
*Flash uploader fixed&lt;br /&gt;
&lt;br /&gt;
===Menu Manager===&lt;br /&gt;
====Menus List====&lt;br /&gt;
*Rebuild button to press when you brick the menu&lt;br /&gt;
*Clicking the menu name brings up the menu items list rather than going into Edit Menu. To edit the menu, click on the check box next to the name and click on the Edit icon in the toolbar.&lt;br /&gt;
&lt;br /&gt;
====Items List====&lt;br /&gt;
*Menus support the language filter&lt;br /&gt;
*Default now called Home&lt;br /&gt;
*Home is now clickable in the menu item list&lt;br /&gt;
*A separate home can be set for different languages&lt;br /&gt;
&lt;br /&gt;
=====New batch operations=====&lt;br /&gt;
*Set access level&lt;br /&gt;
*Copy or move to another part of this or another menu&lt;br /&gt;
&lt;br /&gt;
====Edit Item====&lt;br /&gt;
*Improved &amp;quot;Type&amp;quot; selector with human readable view and layout names&lt;br /&gt;
*Note field added&lt;br /&gt;
*New window target&lt;br /&gt;
*New Language assignment&lt;br /&gt;
*New Template style&lt;br /&gt;
*Ability to add &amp;amp; edit Module assignments from this page&lt;br /&gt;
&lt;br /&gt;
=====New options for the menu links and pages themselves=====&lt;br /&gt;
*Link title attribute&lt;br /&gt;
*Link CSS style&lt;br /&gt;
*Menu image is changed to a modal selector&lt;br /&gt;
*CSS class for page heading&lt;br /&gt;
*Page meta description&lt;br /&gt;
*Page meta keywords&lt;br /&gt;
*Robots options&lt;br /&gt;
&lt;br /&gt;
===Articles Manager===&lt;br /&gt;
*Frontpage is now referred to as Featured&lt;br /&gt;
*Article manager uses submenu to quickly skip between articles , categories and featured&lt;br /&gt;
*Sections and categories are now merged.&lt;br /&gt;
&lt;br /&gt;
====Articles List====&lt;br /&gt;
*&#039;&#039;&amp;quot;Missing move and copy; filter by author&amp;quot;&#039;&#039;&lt;br /&gt;
*New column to show language&lt;br /&gt;
*Filtering by language available&lt;br /&gt;
&lt;br /&gt;
====Article Edit====&lt;br /&gt;
*Created by user now selected by modal popup&lt;br /&gt;
*New ability to set the page title from the article&lt;br /&gt;
*Define create, delete, edit and publishing permissions&lt;br /&gt;
&lt;br /&gt;
====Archived Articles====&lt;br /&gt;
*In 1.5, Archived Articles had to first be changed to Published or Unpublished before update. &lt;br /&gt;
*In 1.6, an Article with an Archived Status *can* be changed without changing the State first.&lt;br /&gt;
&lt;br /&gt;
===Categories===&lt;br /&gt;
====Category List====&lt;br /&gt;
*Nested view&lt;br /&gt;
*Filtering on language&lt;br /&gt;
&lt;br /&gt;
====Edit Category====&lt;br /&gt;
*New note field&lt;br /&gt;
*Section replaced with ability to assign a parent category&lt;br /&gt;
*Ability to assign content language&lt;br /&gt;
&lt;br /&gt;
=====New Options (not previously available in 1.5)=====&lt;br /&gt;
*Assign alternate layout&lt;br /&gt;
*Define create, delete, edit and publishing permissions&lt;br /&gt;
*Meta description&lt;br /&gt;
*Meta keywords&lt;br /&gt;
*Alternative page title&lt;br /&gt;
*Meta author&lt;br /&gt;
*Meta robots&lt;br /&gt;
&lt;br /&gt;
===Banners===&lt;br /&gt;
====Banners list====&lt;br /&gt;
* Missing copy toolbar button&lt;br /&gt;
*New archive toolbar button&lt;br /&gt;
*New columns to show meta keywords, purchase type and language&lt;br /&gt;
*New filtering by client and language&lt;br /&gt;
&lt;br /&gt;
====Edit Banner====&lt;br /&gt;
*New type toggle for Image or Custom (dynamically changes the available form fields)&lt;br /&gt;
*New alt text field for image&lt;br /&gt;
*New language field&lt;br /&gt;
&lt;br /&gt;
=====New Options=====&lt;br /&gt;
*Ability to set the created date&lt;br /&gt;
*Ability to set start and finish publishing times&lt;br /&gt;
*Ability to set the purchase type&lt;br /&gt;
*Ability to track impressions&lt;br /&gt;
*Ability to track clicks&lt;br /&gt;
*Use own prefix ?&lt;br /&gt;
*Tags renamed to meta &lt;br /&gt;
*Contacts&lt;br /&gt;
*Messaging&lt;br /&gt;
*Newsfeeds&lt;br /&gt;
*Search&lt;br /&gt;
*Weblinks&lt;br /&gt;
*Redirect&lt;br /&gt;
&lt;br /&gt;
===Extensions Manager===&lt;br /&gt;
====Discover====&lt;br /&gt;
*Module mgr&lt;br /&gt;
*Plugin Mgr&lt;br /&gt;
*Template Mgr&lt;br /&gt;
*Language mgr&lt;br /&gt;
&lt;br /&gt;
===Misc===&lt;br /&gt;
*Auto create linked contact when creating new user ??&lt;br /&gt;
&lt;br /&gt;
==Access Controls==&lt;br /&gt;
*Introduction&lt;br /&gt;
*User Groups&lt;br /&gt;
*Access Levels&lt;br /&gt;
*Permission Layers&lt;br /&gt;
*How Permissions are Inherited&lt;br /&gt;
*How to debrick your site&lt;br /&gt;
&lt;br /&gt;
==Developers==&lt;br /&gt;
===Introduction===&lt;br /&gt;
*PHP 5.2.4+&lt;br /&gt;
*MySQL 5.0.4 (allows for wide varchars)&lt;br /&gt;
*IE7+, Firefox 3+, Safari 4+&lt;br /&gt;
*Focus on code consistency&lt;br /&gt;
*Focus on code reduction&lt;br /&gt;
&lt;br /&gt;
Usage of PHP Native Functions where possible, for example:&lt;br /&gt;
*[[JXMLElement]] extends the native [http://php.net/manual/en/book.simplexml.php SimpleXML] class&lt;br /&gt;
*[[JDate]] extends the [http://www.php.net/manual/en/class.datetime.php DateTime] class&lt;br /&gt;
*Native INI parser to load languages&lt;br /&gt;
&lt;br /&gt;
===Removed features===&lt;br /&gt;
*ADODB compatibility methods in database classes&lt;br /&gt;
*DOMIT (unsupported XML library)&lt;br /&gt;
*Legacy mode (includes global $mainframe, etc)&lt;br /&gt;
*JTemplate (based on patTemplate)&lt;br /&gt;
*patTemplate (templating engine)&lt;br /&gt;
*PDF support&lt;br /&gt;
*PEAR libraries (due to license incompatibilities)&lt;br /&gt;
*phpgacl&lt;br /&gt;
*PHP 4.0 and 5.0 compatibility files&lt;br /&gt;
*XStandard Editor&lt;br /&gt;
&lt;br /&gt;
===Deprecated Features===&lt;br /&gt;
*JController::_acoSection&lt;br /&gt;
*JController::_acoSectionValue&lt;br /&gt;
*JController::authorize()&lt;br /&gt;
*JController::setAccessControl()&lt;br /&gt;
*JDatabase::stderr()&lt;br /&gt;
*JDate::offest&lt;br /&gt;
*JDate::setOffset()&lt;br /&gt;
*JDate::toFormat() - use JDate::format() instead&lt;br /&gt;
*JException::toString()&lt;br /&gt;
*JFactory::getXMLParser()&lt;br /&gt;
*JHtmlGird::access()&lt;br /&gt;
*JHtmlImage::administrator - use JHtml::image instead&lt;br /&gt;
*JHtmlImage::site - use JHtml::image instead&lt;br /&gt;
*JHtmlList::accesslevel()&lt;br /&gt;
*JHtmlList::specificordering() - use JHtml::_(&#039;list.ordering&#039;)&lt;br /&gt;
*JHtmlList::category()&lt;br /&gt;
*JHtmlSelect::optgroup() - see JHtmlSelect::groupedList()&lt;br /&gt;
*JLanguage::_parseLanguageFiles - renamed to parseLanguageFiles&lt;br /&gt;
*JLanguage::_parseXMLLanguageFile - renamed to parseXMLLanguageFile&lt;br /&gt;
*JLanguage::_parseXMLLanguageFiles - renamed to parseXMLLanguageFiles&lt;br /&gt;
*JObject::toString - replaced with magic method&lt;br /&gt;
*JRegistry::getNameSpaces()&lt;br /&gt;
*JRegistry::getValue()&lt;br /&gt;
*JRegistry::makeNameSpace()&lt;br /&gt;
*JRegistry::setValue()&lt;br /&gt;
*JPane - See JHtmlSliders&lt;br /&gt;
*JParameter - replaced by JForm&lt;br /&gt;
*JSimpleXML, JSimpleXMLElement - Use JXMLElement instead, based on the native SimpleXMLElement&lt;br /&gt;
*JTable::canDelete() - models or controllers should be doing the access checks&lt;br /&gt;
*JTable::toXML()&lt;br /&gt;
*JToolbarHelper customX(), addNewX(), editListX(), editHtmlX(), editCssX(), deleteListX()&lt;br /&gt;
*JUser::authorize() - Use JUser::authorise()&lt;br /&gt;
*JUtility::dump()&lt;br /&gt;
*JUtility::array_unshift_ref() - Not needed in PHP 5&lt;br /&gt;
*JUtility::getHash() - Use JApplication::getHash()&lt;br /&gt;
*JUtility::getToken() - Use JFactory::getSession()-&amp;gt;getFormToken()&lt;br /&gt;
*JUtility::isWinOS() - Use JApplication::isWinOS()&lt;br /&gt;
*JUtility::return_bytes() - See InstallerModelWarnings::return_bytes()&lt;br /&gt;
*JUtility::sendMail() - Use JFactory::getMailer()-&amp;gt;sendMail()&lt;br /&gt;
*JUtility::sendAdminMail() - Use JFactory::getMailer()-&amp;gt;sendMail()&lt;br /&gt;
*JXMLElement::data() - Provided for backward compatibility&lt;br /&gt;
*JXMLElement::getAttribute() - Provided for backward compatibility&lt;br /&gt;
&lt;br /&gt;
===Database===&lt;br /&gt;
*JTable now automatically looks up the fields from the database schema&lt;br /&gt;
*New JDatabaseQuery - A chained CRUD query builder&lt;br /&gt;
*New JDatabase::getNextRow&lt;br /&gt;
*New JDatabase::getNextObject&lt;br /&gt;
*JDatabase::loadAssocList  - Now takes a second argument to just return the value of a column&lt;br /&gt;
*JDatabase::setQuery  - Added chaining support&lt;br /&gt;
&lt;br /&gt;
====Important Schema Changes====&lt;br /&gt;
*New jos_extensions table to list all extensions&lt;br /&gt;
*Components table information moved and split between jos_extensions and jos_menu (special menu called _adminmenu)&lt;br /&gt;
&lt;br /&gt;
The old phpgacl (jos_core_acl*) and jos_groups tables have been reworked into:&lt;br /&gt;
*jos_assets&lt;br /&gt;
*jos_user_usergroup_map&lt;br /&gt;
*jos_usergroups&lt;br /&gt;
*jos_viewlevels&lt;br /&gt;
*Archived state changed from a value of -1 to +2&lt;br /&gt;
&lt;br /&gt;
===Improved MVC===&lt;br /&gt;
====Models====&lt;br /&gt;
*JModelList&lt;br /&gt;
*JModelForm&lt;br /&gt;
*JModelAdmin&lt;br /&gt;
*Format handling (eg JSON)&lt;br /&gt;
*Sub-controller handling&lt;br /&gt;
&lt;br /&gt;
====Controllers====&lt;br /&gt;
*JControllerForm&lt;br /&gt;
*JControllerAdmin&lt;br /&gt;
*JController::setMessage takes second arg to set the message type&lt;br /&gt;
*JController can set the default view&lt;br /&gt;
*Added chaining support to several JController methods&lt;br /&gt;
&lt;br /&gt;
====Views====&lt;br /&gt;
*Semantic core output&lt;br /&gt;
*Milkyway legacy layouts&lt;br /&gt;
*The old component parameters are not automatically added to the menu anymore. You need to explicitly put them in the layout XML files.&lt;br /&gt;
*The menu manager will now detect additional layouts for a given view in the default template.&lt;br /&gt;
&lt;br /&gt;
===Form API===&lt;br /&gt;
====Event manipulation====&lt;br /&gt;
*onContentPrepareForm&lt;br /&gt;
*onContentPrepareFormData&lt;br /&gt;
&lt;br /&gt;
===Translation and Language Support===&lt;br /&gt;
*Support for unicode slugs, eg, SEF URL&#039;s with Greek characters&lt;br /&gt;
*3-letter languages now supported, xxx-XX&lt;br /&gt;
*All existing language keys have been refactored&lt;br /&gt;
&lt;br /&gt;
====INI files must validate====&lt;br /&gt;
*Upper case key with no spaces, alphanumeric characters and underscores&lt;br /&gt;
*Quoted values&lt;br /&gt;
*Double quotes within literal strings must use _QQ_ in the form KEY=&amp;quot;&amp;lt;a href=&amp;quot;_QQ_&amp;quot;index.php&amp;quot;_QQ_&amp;quot;&amp;gt;Click&amp;lt;/a&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====Javascript translation layer====&lt;br /&gt;
*See the flash uploader script for an example&lt;br /&gt;
Local extension language files&lt;br /&gt;
&lt;br /&gt;
====Language file API====&lt;br /&gt;
*Pluralisation support&lt;br /&gt;
*Transliteration support for ASCII or Unicode slugs&lt;br /&gt;
*Ignore Search Words&lt;br /&gt;
*Minimum search word length&lt;br /&gt;
*Custom language overrides&lt;br /&gt;
*System language file to support administrator menu and installation (.sys.ini)&lt;br /&gt;
&lt;br /&gt;
====Language switcher====&lt;br /&gt;
*Language Filter plugin enables language switching&lt;br /&gt;
*Sets the automatic filtering via JFactory::getApplication()-&amp;gt;setLanguageFilter(true)&lt;br /&gt;
*A frontend component with language support would test JFactory::getApplication()-&amp;gt;getLanguageFilter(), which returns the selected language code from the Languages Module&lt;br /&gt;
*The language field can be a language code for a single language, or &amp;quot;*&amp;quot; to be displayed for all languages&lt;br /&gt;
*Community extension for language maintenance com_localise&lt;br /&gt;
&lt;br /&gt;
===Extension management===&lt;br /&gt;
====New installation types====&lt;br /&gt;
=====Libraries=====&lt;br /&gt;
*Must include an XML manifest where type=&amp;quot;library&amp;quot;&lt;br /&gt;
*Can only be installed into a sub-folder of /libraries/&lt;br /&gt;
*Can extend parts of an existing library, eg /libraries/joomla/database/database/oracle.php&lt;br /&gt;
&lt;br /&gt;
=====Packages multi-installer=====&lt;br /&gt;
*Must include an XML manifest where type=&amp;quot;package&amp;quot;&lt;br /&gt;
*A package is a zip of zip&#039;s&lt;br /&gt;
&lt;br /&gt;
New install script can be provided with 5 methods:&lt;br /&gt;
=====preflight=====&lt;br /&gt;
*Runs before anything is run and while the extracted files are in the uploaded temp folder&lt;br /&gt;
&lt;br /&gt;
======Could allow for:======&lt;br /&gt;
*secondary extraction of custom zip&#039;s&lt;br /&gt;
*version checks to be performed&lt;br /&gt;
*halting the installer on an error&lt;br /&gt;
&lt;br /&gt;
=====install / update=====&lt;br /&gt;
*Runs after the database scripts are executed&lt;br /&gt;
*If the extension is new, the install method is run&lt;br /&gt;
*If the extension exists then update method is run if method=&amp;quot;upgrade&amp;quot;, otherwise assumes that the extension is not meant to be upgradable&lt;br /&gt;
&lt;br /&gt;
=====postflight=====&lt;br /&gt;
*Runs after the extension is registered in the database&lt;br /&gt;
*Is not run for the uninstall process (nothing left to do obviously)&lt;br /&gt;
&lt;br /&gt;
====Discover====&lt;br /&gt;
*Does not do any file copying, only works with what it finds&lt;br /&gt;
*Performs preflight, install and postflight&lt;br /&gt;
*Developer of installer has two language files??&lt;br /&gt;
&lt;br /&gt;
====Update site====&lt;br /&gt;
*Can publish an XML manifest on your site that can include individual extensions and extension sets.&lt;br /&gt;
&lt;br /&gt;
====XML Manifest Changes====&lt;br /&gt;
*&amp;lt;install&amp;gt; is deprecated - use &amp;lt;extension&amp;gt;&lt;br /&gt;
*New &amp;lt;update&amp;gt; tag. Takes a &amp;lt;schemas&amp;gt; tag which can define &amp;lt;schemapath&amp;gt;&lt;br /&gt;
*&amp;lt;params&amp;gt; and &amp;lt;param&amp;gt; tags are deprecated, use &amp;lt;fields&amp;gt;, &amp;lt;fieldsets&amp;gt; and &amp;lt;field&amp;gt; instead&lt;br /&gt;
&lt;br /&gt;
====File changes====&lt;br /&gt;
*Installation manifest must be the same name as the extension, eg com_foobar/foobar.xml  This helps with discovery (otherwise the function has to go through all the files in the extension folder&lt;br /&gt;
*Plugins are now in folders like modules and components&lt;br /&gt;
*See SVN/tests/_data/installer_packages/ for complete examples of all extensions and manifests.&lt;br /&gt;
*The method=&amp;quot;upgrade&amp;quot; will compare individual files in the original and incoming manifests and will remove files as appropriate.  However, it will not remove differences in the &amp;lt;folder&amp;gt; tags.&lt;br /&gt;
*Future support for rollback&lt;br /&gt;
&lt;br /&gt;
===Events===&lt;br /&gt;
====New Events====&lt;br /&gt;
*onBeforeRender&lt;br /&gt;
*onContentBeforeDelete&lt;br /&gt;
*onContentAfterDelete&lt;br /&gt;
*onContentChangeState&lt;br /&gt;
*onContentPrepareForm&lt;br /&gt;
*onContentPrepareFormData&lt;br /&gt;
*onExtensionBeforeInstall&lt;br /&gt;
*onExtensionBeforeUpdate&lt;br /&gt;
*onExtensionBeforeUninstall&lt;br /&gt;
*onExtensionAfterInstall&lt;br /&gt;
*onExtensionAfterUpdate&lt;br /&gt;
*onExtensionAfterUninstall&lt;br /&gt;
&lt;br /&gt;
====Renamed Events====&lt;br /&gt;
*onContentAfterSave&lt;br /&gt;
*onContentAfterTitle&lt;br /&gt;
*onContentAfterDisplay&lt;br /&gt;
*onContentBeforeDisplay&lt;br /&gt;
*onContentBeforeSave&lt;br /&gt;
*onContentSearch&lt;br /&gt;
*onContentSearchAreas&lt;br /&gt;
*onUserAuthenticate&lt;br /&gt;
*onUserAfterDelete&lt;br /&gt;
*onUserAfterSave&lt;br /&gt;
*onUserBeforeDelete&lt;br /&gt;
*onUserBeforeSave&lt;br /&gt;
*onUserLogin&lt;br /&gt;
*onUserLogout&lt;br /&gt;
*All content events (except for search and search areas) now pass a &#039;context&#039; as the first argument to alert the plugin as to what type of content is being passed.  The plugin event may or may not heed this context.&lt;br /&gt;
&lt;br /&gt;
===Categories===&lt;br /&gt;
*Component can provide custom options for its own categories via optional category.xml&lt;br /&gt;
*Supported via JTableNested&lt;br /&gt;
&lt;br /&gt;
===Access Controls===&lt;br /&gt;
*A thing that can be controlled by permissions is registered in the assets table&lt;br /&gt;
*JTable handles this transparently via asset_id field&lt;br /&gt;
*For view permissions, support is as simple as adding&lt;br /&gt;
:::$user = JFactory::getUser();&lt;br /&gt;
:::$groups = implode(&#039;,&#039;, $user-&amp;gt;authorisedLevels());&lt;br /&gt;
:::$query-&amp;gt;where(&#039;a.access IN (&#039; . $groups . &#039;)&#039;);&lt;br /&gt;
&lt;br /&gt;
For action permissions, same format as in 1.5:&lt;br /&gt;
$user-&amp;gt;authorise($actionName, $assetName)&lt;br /&gt;
*OpenID library moved to plugin folder&lt;br /&gt;
*Geshi library moved to plugin folder&lt;br /&gt;
*JRegistry notes defaults to JSON (new format), dynamically converting existing data in INI format&lt;br /&gt;
*New JStream&lt;br /&gt;
*New JApplicationHelper::getComponentName&lt;br /&gt;
*Core icons moved to /media/&lt;br /&gt;
*Backward incompatible change to JEditor::display&lt;br /&gt;
*Added chaining support to JMail&lt;br /&gt;
*JFilterInput can no longer be called statically&lt;br /&gt;
*JHtml::image now supports relative paths&lt;br /&gt;
*All system images are overridable in the default template&lt;br /&gt;
*New JHtmlString&lt;br /&gt;
*Added wincache session handler for IIS&lt;br /&gt;
*New JFilterOutput::stripImages&lt;br /&gt;
*JPath::check takes second arg for separator (to pass to JPath::clean)&lt;br /&gt;
*Expanded configuration support through config.xml (multiple tabs)&lt;br /&gt;
&lt;br /&gt;
====Core actions====&lt;br /&gt;
*core.login.site&lt;br /&gt;
*core.login.admin&lt;br /&gt;
*core.admin&lt;br /&gt;
*core.manage&lt;br /&gt;
*core.create&lt;br /&gt;
*core.edit&lt;br /&gt;
*core.edit.state&lt;br /&gt;
*core.delete&lt;br /&gt;
*Miscellaneous changes&lt;br /&gt;
&lt;br /&gt;
===Debug Plugin===&lt;br /&gt;
*More tools for assisting with translation&lt;br /&gt;
&lt;br /&gt;
===Mootools 1.2/1.3===&lt;br /&gt;
*Need to use document.id instead of $&lt;br /&gt;
&lt;br /&gt;
==Cache changes ==&lt;br /&gt;
===API changes relevant to 3rd party developers===&lt;br /&gt;
====Component view cache==== &lt;br /&gt;
&lt;br /&gt;
Component view cache now takes an array of url parameters and their types to create Cacheid. This is a replacement for a previous unsafe way which took the whole URL for this and so opened the doors for DOS attacks via random url parameters added to request URL&#039;s. &lt;br /&gt;
&lt;br /&gt;
Com_contact example: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$safeurlparams = array(&lt;br /&gt;
    &#039;id&#039;=&amp;gt;&#039;INT&#039;, &lt;br /&gt;
    &#039;catid&#039;=&amp;gt;&#039;INT&#039;, &#039;limit&#039;=&amp;gt;&#039;INT&#039;, &lt;br /&gt;
    &#039;limitstart&#039;=&amp;gt;&#039;INT&#039;, &lt;br /&gt;
    &#039;filter_order&#039;=&amp;gt;&#039;CMD&#039;, &lt;br /&gt;
    &#039;filter_order_Dir&#039;=&amp;gt;&#039;CMD&#039;&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
parent::display($cachable,$safeurlparams);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Old cacheid created from URL was retained for backwards compatibility and takes effect if there are no $safeurlparams.&lt;br /&gt;
&lt;br /&gt;
====Module cache====&lt;br /&gt;
This has been completly reconceptualized. Module cache now has 5 different modes of operation, 3 of them are to be set from module XML file, while 2 are meant to be used from within the module itself. Default is backwards compatible oldstatic mode that requires no changes to a module. &lt;br /&gt;
&lt;br /&gt;
Modes to be set in XML: &lt;br /&gt;
*&#039;&#039;&#039;static&#039;&#039;&#039; - one cache file for all pages with the same module parameters &lt;br /&gt;
*&#039;&#039;&#039;oldstatic&#039;&#039;&#039; - 1.5. definition of module caching, one cache file for all pages with the same module id and user aid. Default for backwards compatibility &lt;br /&gt;
*&#039;&#039;&#039;itemid&#039;&#039;&#039; - changes on itemid change &lt;br /&gt;
&lt;br /&gt;
In addition to cache field that was required in 1.5 there is now another hidden field called cachemode that sets any of the above modes. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;field name=&amp;quot;cachemode&amp;quot; type=&amp;quot;hidden&amp;quot; label=&amp;quot;&amp;quot; default=&amp;quot;static&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;option value=&amp;quot;static&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Modes to be called from inside the module: &lt;br /&gt;
*&#039;&#039;&#039;safeuri&#039;&#039;&#039; - id is created from $cacheparams-&amp;gt;modeparams array, the same as in component view cache &lt;br /&gt;
*&#039;&#039;&#039;id&#039;&#039;&#039; - module sets own cache id&#039;s &lt;br /&gt;
&lt;br /&gt;
To use this modes one must rename cache field in xml to owncache field and call JModuleHelper::ModuleCache from within the module&#039;s main php file. This is actually a shortcut to cache callback to avoid code duplication in every module. &lt;br /&gt;
&lt;br /&gt;
An example that uses safeuri mode and replaces uncached&lt;br /&gt;
$list = modRelatedItemsHelper::getList($params) : &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$cacheparams = new stdClass; &lt;br /&gt;
$cacheparams-&amp;gt;cachemode = &#039;safeuri&#039;; &lt;br /&gt;
$cacheparams-&amp;gt;class = &#039;modRelatedItemsHelper&#039;; &lt;br /&gt;
$cacheparams-&amp;gt;method = &#039;getList&#039;; &lt;br /&gt;
$cacheparams-&amp;gt;methodparams = $params; &lt;br /&gt;
$cacheparams-&amp;gt;modeparams = array(&#039;id&#039;=&amp;gt;&#039;int&#039;,&#039;Itemid&#039;=&amp;gt;&#039;int&#039;); &lt;br /&gt;
$list = JModuleHelper::ModuleCache ($module, $params, $cacheparams);&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
====Functional changes==== &lt;br /&gt;
&#039;&#039;&#039;Cache administration (Clean cache, Purge cache) now works with all drivers&#039;&#039;&#039;, not only with file cache. &lt;br /&gt;
&#039;&#039;&#039;New standalone garbage collect script&#039;&#039;&#039; that is to be called from crontab has been added. It can be found in libraries/joomla/utilities/garbagecron.php . For safety reasons it is recommended that it is renamed to something unique.&lt;br /&gt;
&lt;br /&gt;
====CMS and framework level functional changes==== &lt;br /&gt;
&#039;&#039;&#039;Caching is implemented in all components and modules&#039;&#039;&#039; that can potentially gain from cache.&lt;br /&gt;
Caching has also been added to some most expensive and frequent framework calls JComponentHelper::_load(), JModuleHelper::_load(),JMenuSite::load(); &lt;br /&gt;
&lt;br /&gt;
====Cache library changes====&lt;br /&gt;
Cache library has been completely refactored. &lt;br /&gt;
*Cache &#039;&#039;&#039;handlers have been renamed to controllers&#039;&#039;&#039; to better reflect their role and avoid confusion with cache storage handlers (referred to as drivers in following text). &lt;br /&gt;
*&#039;&#039;&#039;New JCacheController&#039;&#039;&#039; parent class has been added and inheritance has been changed to prevent bugs occurring from controller&#039;s and storage handler&#039;s get method clashes. &lt;br /&gt;
&lt;br /&gt;
====JCache==== &lt;br /&gt;
*&#039;&#039;&#039;getAll()&#039;&#039;&#039; method was added to JCache, JCacheStorage and all drivers, and it returns all cached items (this was previously possible only with file driver and hardcoded in administration) &lt;br /&gt;
*New &#039;&#039;&#039;lock and unlock&#039;&#039;&#039; methods were added to JCache, JCacheStorage and drivers. They enable cache item locking and unlocking to prevent errors on parallel accesses and double saves. This functionally was also implemented in controllers. &lt;br /&gt;
*Workarounds are now consolidated in new &#039;&#039;&#039;JCache getWorkarounds and setWorkarounds&#039;&#039;&#039; methods, are now used by all controllers and their use has been made optional. &lt;br /&gt;
*New makeId() method in JCache that creates cache id from registered url parameters set by components and system plugins&lt;br /&gt;
&lt;br /&gt;
====JCacheController==== &lt;br /&gt;
New parent class to Controllers that also functions as an intermediate to JCache. There is no JObject inheritance as otherwise magic __call doesn&#039;t work. &lt;br /&gt;
Change was needed to prevent bugs occurring from controller&#039;s and storage handler&#039;s get method clashes. They could be renamed but this would break backwards compatibility.&lt;br /&gt;
&lt;br /&gt;
====JCacheStorage==== &lt;br /&gt;
*_getCacheId method was moved from drivers to their parent JCacheStorage and all drives now use the same method by default &lt;br /&gt;
*CacheItem was moved from cache admin to framework JCacheStorageHelper, it is used by getAll &lt;br /&gt;
*There are new cachelite and wincache drivers. All other drivers have been fixed with missing functions (gc, clean) added, their code cleaned and tested they should be now working properly. &lt;br /&gt;
*Replaced separate _expire files in filecache driver with timestamps (this should amount to cca. 40% speed gain). The same in all drivers that had this. &lt;br /&gt;
*Numerous bugfixes on all levels, most important is proper use of options defaulting to configuration parameters settings and correctly passing from level to level.&lt;br /&gt;
&lt;br /&gt;
====Other framework level changes==== &lt;br /&gt;
*Safe url parameters registration added to JControler view method. &lt;br /&gt;
*New ModuleCache method in JModuleHelper that performs the above described module cache (in 5 modes) for both, modules and module renderer. &lt;br /&gt;
*JFactory::getFeedParser has been changed to use Joomla caching instead of simplepie&#039;s.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
===Eliminate the usage of JTable for general browsing on the frontend===&lt;br /&gt;
*Session drops the usage of JTable&lt;br /&gt;
*Item views use a dedicated question, not JTable-&amp;gt;load&lt;br /&gt;
&lt;br /&gt;
==Known Issues==&lt;br /&gt;
*Still Mootools 1.2. Will be upgrading to 1.3 during the beta process.&lt;br /&gt;
*Scaling issues to address&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
===Releases===&lt;br /&gt;
*Alpha 1: 22 June 2009&lt;br /&gt;
*Alpha 2: 25 October 2009&lt;br /&gt;
*Beta 1: 18 May 2010&lt;br /&gt;
*Beta 2: 31 May 2010&lt;br /&gt;
*Beta 3: 14 June 2010&lt;br /&gt;
*Beta 4: 28 June 2010&lt;br /&gt;
*Beta 5: 12 July 2010&lt;br /&gt;
*Beta 6: 26 July 2010&lt;br /&gt;
*Beta 7: 09 August 2010&lt;br /&gt;
&lt;br /&gt;
[[Category:Joomla! 1.6]]&lt;/div&gt;</summary>
		<author><name>Kissaki</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J2.5:What%27s_new_in_Joomla_2.5&amp;diff=30770</id>
		<title>J2.5:What&#039;s new in Joomla 2.5</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J2.5:What%27s_new_in_Joomla_2.5&amp;diff=30770"/>
		<updated>2010-09-18T19:44:00Z</updated>

		<summary type="html">&lt;p&gt;Kissaki: /* Articles Manager */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Lots of things.&lt;br /&gt;
&lt;br /&gt;
...and:&lt;br /&gt;
* &#039;&#039;&#039;New Access Control System&#039;&#039;&#039; - Allows site administrators control over who can view and manage content.&lt;br /&gt;
* &#039;&#039;&#039;Unlimited Depth Organizational Model&#039;&#039;&#039; - Gives site administrators and content creators user-defined category levels that allow for the creation of a category tree with as many or as few levels for organizing articles and other content as needed.&lt;br /&gt;
* &#039;&#039;&#039;One-Click Extension Updates&#039;&#039;&#039; - Allows users to keep sites secure and controlled by simplifying the process of updating extensions.&lt;br /&gt;
* &#039;&#039;&#039;Semantic XHTML Layouts&#039;&#039;&#039; - Provides a better baseline for content presentation.&lt;br /&gt;
&lt;br /&gt;
...and:&lt;br /&gt;
&lt;br /&gt;
==Administrators==&lt;br /&gt;
===Introduction===&lt;br /&gt;
*Consistent UI&lt;br /&gt;
*Consistent Features&lt;br /&gt;
*Richer sample data&lt;br /&gt;
*IE 7+, Firefox 3.x, Safari 4.x&lt;br /&gt;
*PHP 5.2.4+&lt;br /&gt;
*MySQL 5.0.4 (allows for wide varchars)&lt;br /&gt;
&lt;br /&gt;
===Administrator===&lt;br /&gt;
*Menu Changes&lt;br /&gt;
*Submenu consistency&lt;br /&gt;
&lt;br /&gt;
====Toolbar Features====&lt;br /&gt;
*Save&lt;br /&gt;
*Save &amp;amp; Close&lt;br /&gt;
*Save &amp;amp; New&lt;br /&gt;
*Save as Copy&lt;br /&gt;
*Expired session will return to the page you were on then you got logged out (can be hit and miss)&lt;br /&gt;
*Most search filters allow you to search for a record id via [ id:123 ]&lt;br /&gt;
*&amp;quot;Parameters&amp;quot; are now referred to as &amp;quot;Options&amp;quot;&lt;br /&gt;
*Template Styles&lt;br /&gt;
*Integrated Trash Management&lt;br /&gt;
*Consistent archive support for most content&lt;br /&gt;
*Extension Installer Improvements&lt;br /&gt;
&lt;br /&gt;
===Module Enhancements===&lt;br /&gt;
*Publish up and down&lt;br /&gt;
*Add option to display on all pages &amp;quot;except&amp;quot; selected&lt;br /&gt;
*Expanded Category System&lt;br /&gt;
*404 Page Redirection&lt;br /&gt;
*Better Menu Management&lt;br /&gt;
*Alternative layouts for content, modules and menus (taken from the home template)&lt;br /&gt;
&lt;br /&gt;
===New Templates===&lt;br /&gt;
*Atomic&lt;br /&gt;
*Beez2&lt;br /&gt;
*(Administrator) Bluestork (replaces Khephri)&lt;br /&gt;
*(Administrator) Hathor&lt;br /&gt;
*Legacy layer in Milkyway&lt;br /&gt;
*Backend supports layout overrides&lt;br /&gt;
*New Modules&lt;br /&gt;
*New Plugins&lt;br /&gt;
*Content Languages&lt;br /&gt;
*User Login Permissions&lt;br /&gt;
*Activate selected users from the user list now (and filter)&lt;br /&gt;
*Administrator registration approval&lt;br /&gt;
*Polls component removed&lt;br /&gt;
*New codemirror editor&lt;br /&gt;
&lt;br /&gt;
===SEO Improvements===&lt;br /&gt;
*Meta decription and keywords for categories&lt;br /&gt;
*Articles can change the page title and page header separately&lt;br /&gt;
&lt;br /&gt;
===Global Configuration===&lt;br /&gt;
*Add site name to titles&lt;br /&gt;
*Default Access Level&lt;br /&gt;
*Set Metadata Language (buggy)&lt;br /&gt;
*Unicode Aliases&lt;br /&gt;
*Cookie domain and path&lt;br /&gt;
*User Setting moved to User Manager -&amp;gt; Options&lt;br /&gt;
*Media Settings moved to Media Manager -&amp;gt; Options&lt;br /&gt;
*Debug Modules - allows you to enabled to disable the tp=1 feature&lt;br /&gt;
*Server Timezone now a location, not an integer offset&lt;br /&gt;
*New Global Permissions tab&lt;br /&gt;
&lt;br /&gt;
===User Manager===&lt;br /&gt;
*Can activate a user from the list now&lt;br /&gt;
*User can be assigned to multiple groups&lt;br /&gt;
*Manage user groups&lt;br /&gt;
*Manager content access levels&lt;br /&gt;
&lt;br /&gt;
===Media Manager===&lt;br /&gt;
*Flash uploader fixed&lt;br /&gt;
&lt;br /&gt;
===Menu Manager===&lt;br /&gt;
====Menus List====&lt;br /&gt;
*Rebuild button to press when you brick the menu&lt;br /&gt;
*Clicking the menu name brings up the menu items list rather than going into Edit Menu. To edit the menu, click on the check box next to the name and click on the Edit icon in the toolbar.&lt;br /&gt;
&lt;br /&gt;
====Items List====&lt;br /&gt;
*Menus support the language filter&lt;br /&gt;
*Default now called Home&lt;br /&gt;
*Home is now clickable in the menu item list&lt;br /&gt;
*A separate home can be set for different languages&lt;br /&gt;
&lt;br /&gt;
=====New batch operations=====&lt;br /&gt;
*Set access level&lt;br /&gt;
*Copy or move to another part of this or another menu&lt;br /&gt;
&lt;br /&gt;
====Edit Item====&lt;br /&gt;
*Improved &amp;quot;Type&amp;quot; selector with human readable view and layout names&lt;br /&gt;
*Note field added&lt;br /&gt;
*New window target&lt;br /&gt;
*New Language assignment&lt;br /&gt;
*New Template style&lt;br /&gt;
*Ability to add &amp;amp; edit Module assignments from this page&lt;br /&gt;
&lt;br /&gt;
=====New options for the menu links and pages themselves=====&lt;br /&gt;
*Link title attribute&lt;br /&gt;
*Link CSS style&lt;br /&gt;
*Menu image is changed to a modal selector&lt;br /&gt;
*CSS class for page heading&lt;br /&gt;
*Page meta description&lt;br /&gt;
*Page meta keywords&lt;br /&gt;
*Robots options&lt;br /&gt;
&lt;br /&gt;
===Articles Manager===&lt;br /&gt;
*Frontpage is now referred to as Featured&lt;br /&gt;
*Article manager uses submenu to quickly skip between articles , categories and featured&lt;br /&gt;
*Sections and categories are now merged.&lt;br /&gt;
&lt;br /&gt;
====Articles List====&lt;br /&gt;
*&#039;&#039;&amp;quot;Missing move and copy; filter by author&amp;quot;&#039;&#039;&lt;br /&gt;
*New column to show language&lt;br /&gt;
*Filtering by language available&lt;br /&gt;
&lt;br /&gt;
====Article Edit====&lt;br /&gt;
*Created by user now selected by modal popup&lt;br /&gt;
*New ability to set the page title from the article&lt;br /&gt;
*Define create, delete, edit and publishing permissions&lt;br /&gt;
&lt;br /&gt;
====Archived Articles====&lt;br /&gt;
*In 1.5, Archived Articles had to first be changed to Published or Unpublished before update. &lt;br /&gt;
*In 1.6, an Article with an Archived Status *can* be changed without changing the State first.&lt;br /&gt;
&lt;br /&gt;
===Categories===&lt;br /&gt;
====Category List====&lt;br /&gt;
*Nested view&lt;br /&gt;
*Filtering on language&lt;br /&gt;
&lt;br /&gt;
====Edit Category====&lt;br /&gt;
*New note field&lt;br /&gt;
*Section replaced with ability to assign a parent category&lt;br /&gt;
*Ability to assign content language&lt;br /&gt;
&lt;br /&gt;
=====New Options (not previously available in 1.5)=====&lt;br /&gt;
*Assign alternate layout&lt;br /&gt;
*Define create, delete, edit and publishing permissions&lt;br /&gt;
*Meta description&lt;br /&gt;
*Meta keywords&lt;br /&gt;
*Alternative page title&lt;br /&gt;
*Meta author&lt;br /&gt;
*Meta robots&lt;br /&gt;
&lt;br /&gt;
===Banners===&lt;br /&gt;
====Banners list====&lt;br /&gt;
*** Missing copy toolbar button&lt;br /&gt;
*New archive toolbar button&lt;br /&gt;
*New columns to show meta keywords, purchase type and language&lt;br /&gt;
*New filtering by client and language &lt;br /&gt;
&lt;br /&gt;
====Edit Banner====&lt;br /&gt;
*New type toggle for Image or Custom (dynamically changes the available form fields)&lt;br /&gt;
*New alt text field for image&lt;br /&gt;
*New language field&lt;br /&gt;
&lt;br /&gt;
=====New Options=====&lt;br /&gt;
*Ability to set the created date&lt;br /&gt;
*Ability to set start and finish publishing times&lt;br /&gt;
*Ability to set the purchase type&lt;br /&gt;
*Ability to track impressions&lt;br /&gt;
*Ability to track clicks&lt;br /&gt;
*Use own prefix ?&lt;br /&gt;
*Tags renamed to meta &lt;br /&gt;
*Contacts&lt;br /&gt;
*Messaging&lt;br /&gt;
*Newsfeeds&lt;br /&gt;
*Search&lt;br /&gt;
*Weblinks&lt;br /&gt;
*Redirect&lt;br /&gt;
&lt;br /&gt;
===Extensions Manager===&lt;br /&gt;
====Discover====&lt;br /&gt;
*Module mgr&lt;br /&gt;
*Plugin Mgr&lt;br /&gt;
*Template Mgr&lt;br /&gt;
*Language mgr&lt;br /&gt;
&lt;br /&gt;
===Misc===&lt;br /&gt;
*Auto create linked contact when creating new user ??&lt;br /&gt;
&lt;br /&gt;
==Access Controls==&lt;br /&gt;
*Introduction&lt;br /&gt;
*User Groups&lt;br /&gt;
*Access Levels&lt;br /&gt;
*Permission Layers&lt;br /&gt;
*How Permissions are Inherited&lt;br /&gt;
*How to debrick your site&lt;br /&gt;
&lt;br /&gt;
==Developers==&lt;br /&gt;
===Introduction===&lt;br /&gt;
*PHP 5.2.4+&lt;br /&gt;
*MySQL 5.0.4 (allows for wide varchars)&lt;br /&gt;
*IE7+, Firefox 3+, Safari 4+&lt;br /&gt;
*Focus on code consistency&lt;br /&gt;
*Focus on code reduction&lt;br /&gt;
&lt;br /&gt;
Usage of PHP Native Functions where possible, for example:&lt;br /&gt;
*[[JXMLElement]] extends the native [http://php.net/manual/en/book.simplexml.php SimpleXML] class&lt;br /&gt;
*[[JDate]] extends the [http://www.php.net/manual/en/class.datetime.php DateTime] class&lt;br /&gt;
*Native INI parser to load languages&lt;br /&gt;
&lt;br /&gt;
===Removed features===&lt;br /&gt;
*ADODB compatibility methods in database classes&lt;br /&gt;
*DOMIT (unsupported XML library)&lt;br /&gt;
*Legacy mode (includes global $mainframe, etc)&lt;br /&gt;
*JTemplate (based on patTemplate)&lt;br /&gt;
*patTemplate (templating engine)&lt;br /&gt;
*PDF support&lt;br /&gt;
*PEAR libraries (due to license incompatibilities)&lt;br /&gt;
*phpgacl&lt;br /&gt;
*PHP 4.0 and 5.0 compatibility files&lt;br /&gt;
*XStandard Editor&lt;br /&gt;
&lt;br /&gt;
===Deprecated Features===&lt;br /&gt;
*JController::_acoSection&lt;br /&gt;
*JController::_acoSectionValue&lt;br /&gt;
*JController::authorize()&lt;br /&gt;
*JController::setAccessControl()&lt;br /&gt;
*JDatabase::stderr()&lt;br /&gt;
*JDate::offest&lt;br /&gt;
*JDate::setOffset()&lt;br /&gt;
*JDate::toFormat() - use JDate::format() instead&lt;br /&gt;
*JException::toString()&lt;br /&gt;
*JFactory::getXMLParser()&lt;br /&gt;
*JHtmlGird::access()&lt;br /&gt;
*JHtmlImage::administrator - use JHtml::image instead&lt;br /&gt;
*JHtmlImage::site - use JHtml::image instead&lt;br /&gt;
*JHtmlList::accesslevel()&lt;br /&gt;
*JHtmlList::specificordering() - use JHtml::_(&#039;list.ordering&#039;)&lt;br /&gt;
*JHtmlList::category()&lt;br /&gt;
*JHtmlSelect::optgroup() - see JHtmlSelect::groupedList()&lt;br /&gt;
*JLanguage::_parseLanguageFiles - renamed to parseLanguageFiles&lt;br /&gt;
*JLanguage::_parseXMLLanguageFile - renamed to parseXMLLanguageFile&lt;br /&gt;
*JLanguage::_parseXMLLanguageFiles - renamed to parseXMLLanguageFiles&lt;br /&gt;
*JObject::toString - replaced with magic method&lt;br /&gt;
*JRegistry::getNameSpaces()&lt;br /&gt;
*JRegistry::getValue()&lt;br /&gt;
*JRegistry::makeNameSpace()&lt;br /&gt;
*JRegistry::setValue()&lt;br /&gt;
*JPane - See JHtmlSliders&lt;br /&gt;
*JParameter - replaced by JForm&lt;br /&gt;
*JSimpleXML, JSimpleXMLElement - Use JXMLElement instead, based on the native SimpleXMLElement&lt;br /&gt;
*JTable::canDelete() - models or controllers should be doing the access checks&lt;br /&gt;
*JTable::toXML()&lt;br /&gt;
*JToolbarHelper customX(), addNewX(), editListX(), editHtmlX(), editCssX(), deleteListX()&lt;br /&gt;
*JUser::authorize() - Use JUser::authorise()&lt;br /&gt;
*JUtility::dump()&lt;br /&gt;
*JUtility::array_unshift_ref() - Not needed in PHP 5&lt;br /&gt;
*JUtility::getHash() - Use JApplication::getHash()&lt;br /&gt;
*JUtility::getToken() - Use JFactory::getSession()-&amp;gt;getFormToken()&lt;br /&gt;
*JUtility::isWinOS() - Use JApplication::isWinOS()&lt;br /&gt;
*JUtility::return_bytes() - See InstallerModelWarnings::return_bytes()&lt;br /&gt;
*JUtility::sendMail() - Use JFactory::getMailer()-&amp;gt;sendMail()&lt;br /&gt;
*JUtility::sendAdminMail() - Use JFactory::getMailer()-&amp;gt;sendMail()&lt;br /&gt;
*JXMLElement::data() - Provided for backward compatibility&lt;br /&gt;
*JXMLElement::getAttribute() - Provided for backward compatibility&lt;br /&gt;
&lt;br /&gt;
===Database===&lt;br /&gt;
*JTable now automatically looks up the fields from the database schema&lt;br /&gt;
*New JDatabaseQuery - A chained CRUD query builder&lt;br /&gt;
*New JDatabase::getNextRow&lt;br /&gt;
*New JDatabase::getNextObject&lt;br /&gt;
*JDatabase::loadAssocList  - Now takes a second argument to just return the value of a column&lt;br /&gt;
*JDatabase::setQuery  - Added chaining support&lt;br /&gt;
&lt;br /&gt;
====Important Schema Changes====&lt;br /&gt;
*New jos_extensions table to list all extensions&lt;br /&gt;
*Components table information moved and split between jos_extensions and jos_menu (special menu called _adminmenu)&lt;br /&gt;
&lt;br /&gt;
The old phpgacl (jos_core_acl*) and jos_groups tables have been reworked into:&lt;br /&gt;
*jos_assets&lt;br /&gt;
*jos_user_usergroup_map&lt;br /&gt;
*jos_usergroups&lt;br /&gt;
*jos_viewlevels&lt;br /&gt;
*Archived state changed from a value of -1 to +2&lt;br /&gt;
&lt;br /&gt;
===Improved MVC===&lt;br /&gt;
====Models====&lt;br /&gt;
*JModelList&lt;br /&gt;
*JModelForm&lt;br /&gt;
*JModelAdmin&lt;br /&gt;
*Format handling (eg JSON)&lt;br /&gt;
*Sub-controller handling&lt;br /&gt;
&lt;br /&gt;
====Controllers====&lt;br /&gt;
*JControllerForm&lt;br /&gt;
*JControllerAdmin&lt;br /&gt;
*JController::setMessage takes second arg to set the message type&lt;br /&gt;
*JController can set the default view&lt;br /&gt;
*Added chaining support to several JController methods&lt;br /&gt;
&lt;br /&gt;
====Views====&lt;br /&gt;
*Semantic core output&lt;br /&gt;
*Milkyway legacy layouts&lt;br /&gt;
*The old component parameters are not automatically added to the menu anymore. You need to explicitly put them in the layout XML files.&lt;br /&gt;
*The menu manager will now detect additional layouts for a given view in the default template.&lt;br /&gt;
&lt;br /&gt;
===Form API===&lt;br /&gt;
====Event manipulation====&lt;br /&gt;
*onContentPrepareForm&lt;br /&gt;
*onContentPrepareFormData&lt;br /&gt;
&lt;br /&gt;
===Translation and Language Support===&lt;br /&gt;
*Support for unicode slugs, eg, SEF URL&#039;s with Greek characters&lt;br /&gt;
*3-letter languages now supported, xxx-XX&lt;br /&gt;
*All existing language keys have been refactored&lt;br /&gt;
&lt;br /&gt;
====INI files must validate====&lt;br /&gt;
*Upper case key with no spaces, alphanumeric characters and underscores&lt;br /&gt;
*Quoted values&lt;br /&gt;
*Double quotes within literal strings must use _QQ_ in the form KEY=&amp;quot;&amp;lt;a href=&amp;quot;_QQ_&amp;quot;index.php&amp;quot;_QQ_&amp;quot;&amp;gt;Click&amp;lt;/a&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====Javascript translation layer====&lt;br /&gt;
*See the flash uploader script for an example&lt;br /&gt;
Local extension language files&lt;br /&gt;
&lt;br /&gt;
====Language file API====&lt;br /&gt;
*Pluralisation support&lt;br /&gt;
*Transliteration support for ASCII or Unicode slugs&lt;br /&gt;
*Ignore Search Words&lt;br /&gt;
*Minimum search word length&lt;br /&gt;
*Custom language overrides&lt;br /&gt;
*System language file to support administrator menu and installation (.sys.ini)&lt;br /&gt;
&lt;br /&gt;
====Language switcher====&lt;br /&gt;
*Language Filter plugin enables language switching&lt;br /&gt;
*Sets the automatic filtering via JFactory::getApplication()-&amp;gt;setLanguageFilter(true)&lt;br /&gt;
*A frontend component with language support would test JFactory::getApplication()-&amp;gt;getLanguageFilter(), which returns the selected language code from the Languages Module&lt;br /&gt;
*The language field can be a language code for a single language, or &amp;quot;*&amp;quot; to be displayed for all languages&lt;br /&gt;
*Community extension for language maintenance com_localise&lt;br /&gt;
&lt;br /&gt;
===Extension management===&lt;br /&gt;
====New installation types====&lt;br /&gt;
=====Libraries=====&lt;br /&gt;
*Must include an XML manifest where type=&amp;quot;library&amp;quot;&lt;br /&gt;
*Can only be installed into a sub-folder of /libraries/&lt;br /&gt;
*Can extend parts of an existing library, eg /libraries/joomla/database/database/oracle.php&lt;br /&gt;
&lt;br /&gt;
=====Packages multi-installer=====&lt;br /&gt;
*Must include an XML manifest where type=&amp;quot;package&amp;quot;&lt;br /&gt;
*A package is a zip of zip&#039;s&lt;br /&gt;
&lt;br /&gt;
New install script can be provided with 5 methods:&lt;br /&gt;
=====preflight=====&lt;br /&gt;
*Runs before anything is run and while the extracted files are in the uploaded temp folder&lt;br /&gt;
&lt;br /&gt;
======Could allow for:======&lt;br /&gt;
*secondary extraction of custom zip&#039;s&lt;br /&gt;
*version checks to be performed&lt;br /&gt;
*halting the installer on an error&lt;br /&gt;
&lt;br /&gt;
=====install / update=====&lt;br /&gt;
*Runs after the database scripts are executed&lt;br /&gt;
*If the extension is new, the install method is run&lt;br /&gt;
*If the extension exists then update method is run if method=&amp;quot;upgrade&amp;quot;, otherwise assumes that the extension is not meant to be upgradable&lt;br /&gt;
&lt;br /&gt;
=====postflight=====&lt;br /&gt;
*Runs after the extension is registered in the database&lt;br /&gt;
*Is not run for the uninstall process (nothing left to do obviously)&lt;br /&gt;
&lt;br /&gt;
====Discover====&lt;br /&gt;
*Does not do any file copying, only works with what it finds&lt;br /&gt;
*Performs preflight, install and postflight&lt;br /&gt;
*Developer of installer has two language files??&lt;br /&gt;
&lt;br /&gt;
====Update site====&lt;br /&gt;
*Can publish an XML manifest on your site that can include individual extensions and extension sets.&lt;br /&gt;
&lt;br /&gt;
====XML Manifest Changes====&lt;br /&gt;
*&amp;lt;install&amp;gt; is deprecated - use &amp;lt;extension&amp;gt;&lt;br /&gt;
*New &amp;lt;update&amp;gt; tag. Takes a &amp;lt;schemas&amp;gt; tag which can define &amp;lt;schemapath&amp;gt;&lt;br /&gt;
*&amp;lt;params&amp;gt; and &amp;lt;param&amp;gt; tags are deprecated, use &amp;lt;fields&amp;gt;, &amp;lt;fieldsets&amp;gt; and &amp;lt;field&amp;gt; instead&lt;br /&gt;
&lt;br /&gt;
====File changes====&lt;br /&gt;
*Installation manifest must be the same name as the extension, eg com_foobar/foobar.xml  This helps with discovery (otherwise the function has to go through all the files in the extension folder&lt;br /&gt;
*Plugins are now in folders like modules and components&lt;br /&gt;
*See SVN/tests/_data/installer_packages/ for complete examples of all extensions and manifests.&lt;br /&gt;
*The method=&amp;quot;upgrade&amp;quot; will compare individual files in the original and incoming manifests and will remove files as appropriate.  However, it will not remove differences in the &amp;lt;folder&amp;gt; tags.&lt;br /&gt;
*Future support for rollback&lt;br /&gt;
&lt;br /&gt;
===Events===&lt;br /&gt;
====New Events====&lt;br /&gt;
*onBeforeRender&lt;br /&gt;
*onContentBeforeDelete&lt;br /&gt;
*onContentAfterDelete&lt;br /&gt;
*onContentChangeState&lt;br /&gt;
*onContentPrepareForm&lt;br /&gt;
*onContentPrepareFormData&lt;br /&gt;
*onExtensionBeforeInstall&lt;br /&gt;
*onExtensionBeforeUpdate&lt;br /&gt;
*onExtensionBeforeUninstall&lt;br /&gt;
*onExtensionAfterInstall&lt;br /&gt;
*onExtensionAfterUpdate&lt;br /&gt;
*onExtensionAfterUninstall&lt;br /&gt;
&lt;br /&gt;
====Renamed Events====&lt;br /&gt;
*onContentAfterSave&lt;br /&gt;
*onContentAfterTitle&lt;br /&gt;
*onContentAfterDisplay&lt;br /&gt;
*onContentBeforeDisplay&lt;br /&gt;
*onContentBeforeSave&lt;br /&gt;
*onContentSearch&lt;br /&gt;
*onContentSearchAreas&lt;br /&gt;
*onUserAuthenticate&lt;br /&gt;
*onUserAfterDelete&lt;br /&gt;
*onUserAfterSave&lt;br /&gt;
*onUserBeforeDelete&lt;br /&gt;
*onUserBeforeSave&lt;br /&gt;
*onUserLogin&lt;br /&gt;
*onUserLogout&lt;br /&gt;
*All content events (except for search and search areas) now pass a &#039;context&#039; as the first argument to alert the plugin as to what type of content is being passed.  The plugin event may or may not heed this context.&lt;br /&gt;
&lt;br /&gt;
===Categories===&lt;br /&gt;
*Component can provide custom options for its own categories via optional category.xml&lt;br /&gt;
*Supported via JTableNested&lt;br /&gt;
&lt;br /&gt;
===Access Controls===&lt;br /&gt;
*A thing that can be controlled by permissions is registered in the assets table&lt;br /&gt;
*JTable handles this transparently via asset_id field&lt;br /&gt;
*For view permissions, support is as simple as adding&lt;br /&gt;
:::$user = JFactory::getUser();&lt;br /&gt;
:::$groups = implode(&#039;,&#039;, $user-&amp;gt;authorisedLevels());&lt;br /&gt;
:::$query-&amp;gt;where(&#039;a.access IN (&#039; . $groups . &#039;)&#039;);&lt;br /&gt;
&lt;br /&gt;
For action permissions, same format as in 1.5:&lt;br /&gt;
$user-&amp;gt;authorise($actionName, $assetName)&lt;br /&gt;
*OpenID library moved to plugin folder&lt;br /&gt;
*Geshi library moved to plugin folder&lt;br /&gt;
*JRegistry notes defaults to JSON (new format), dynamically converting existing data in INI format&lt;br /&gt;
*New JStream&lt;br /&gt;
*New JApplicationHelper::getComponentName&lt;br /&gt;
*Core icons moved to /media/&lt;br /&gt;
*Backward incompatible change to JEditor::display&lt;br /&gt;
*Added chaining support to JMail&lt;br /&gt;
*JFilterInput can no longer be called statically&lt;br /&gt;
*JHtml::image now supports relative paths&lt;br /&gt;
*All system images are overridable in the default template&lt;br /&gt;
*New JHtmlString&lt;br /&gt;
*Added wincache session handler for IIS&lt;br /&gt;
*New JFilterOutput::stripImages&lt;br /&gt;
*JPath::check takes second arg for separator (to pass to JPath::clean)&lt;br /&gt;
*Expanded configuration support through config.xml (multiple tabs)&lt;br /&gt;
&lt;br /&gt;
====Core actions====&lt;br /&gt;
*core.login.site&lt;br /&gt;
*core.login.admin&lt;br /&gt;
*core.admin&lt;br /&gt;
*core.manage&lt;br /&gt;
*core.create&lt;br /&gt;
*core.edit&lt;br /&gt;
*core.edit.state&lt;br /&gt;
*core.delete&lt;br /&gt;
*Miscellaneous changes&lt;br /&gt;
&lt;br /&gt;
===Debug Plugin===&lt;br /&gt;
*More tools for assisting with translation&lt;br /&gt;
&lt;br /&gt;
===Mootools 1.2/1.3===&lt;br /&gt;
*Need to use document.id instead of $&lt;br /&gt;
&lt;br /&gt;
==Cache changes ==&lt;br /&gt;
===API changes relevant to 3rd party developers===&lt;br /&gt;
====Component view cache==== &lt;br /&gt;
&lt;br /&gt;
Component view cache now takes an array of url parameters and their types to create Cacheid. This is a replacement for a previous unsafe way which took the whole URL for this and so opened the doors for DOS attacks via random url parameters added to request URL&#039;s. &lt;br /&gt;
&lt;br /&gt;
Com_contact example: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$safeurlparams = array(&lt;br /&gt;
    &#039;id&#039;=&amp;gt;&#039;INT&#039;, &lt;br /&gt;
    &#039;catid&#039;=&amp;gt;&#039;INT&#039;, &#039;limit&#039;=&amp;gt;&#039;INT&#039;, &lt;br /&gt;
    &#039;limitstart&#039;=&amp;gt;&#039;INT&#039;, &lt;br /&gt;
    &#039;filter_order&#039;=&amp;gt;&#039;CMD&#039;, &lt;br /&gt;
    &#039;filter_order_Dir&#039;=&amp;gt;&#039;CMD&#039;&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
parent::display($cachable,$safeurlparams);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Old cacheid created from URL was retained for backwards compatibility and takes effect if there are no $safeurlparams.&lt;br /&gt;
&lt;br /&gt;
====Module cache====&lt;br /&gt;
This has been completly reconceptualized. Module cache now has 5 different modes of operation, 3 of them are to be set from module XML file, while 2 are meant to be used from within the module itself. Default is backwards compatible oldstatic mode that requires no changes to a module. &lt;br /&gt;
&lt;br /&gt;
Modes to be set in XML: &lt;br /&gt;
*&#039;&#039;&#039;static&#039;&#039;&#039; - one cache file for all pages with the same module parameters &lt;br /&gt;
*&#039;&#039;&#039;oldstatic&#039;&#039;&#039; - 1.5. definition of module caching, one cache file for all pages with the same module id and user aid. Default for backwards compatibility &lt;br /&gt;
*&#039;&#039;&#039;itemid&#039;&#039;&#039; - changes on itemid change &lt;br /&gt;
&lt;br /&gt;
In addition to cache field that was required in 1.5 there is now another hidden field called cachemode that sets any of the above modes. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;field name=&amp;quot;cachemode&amp;quot; type=&amp;quot;hidden&amp;quot; label=&amp;quot;&amp;quot; default=&amp;quot;static&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;option value=&amp;quot;static&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Modes to be called from inside the module: &lt;br /&gt;
*&#039;&#039;&#039;safeuri&#039;&#039;&#039; - id is created from $cacheparams-&amp;gt;modeparams array, the same as in component view cache &lt;br /&gt;
*&#039;&#039;&#039;id&#039;&#039;&#039; - module sets own cache id&#039;s &lt;br /&gt;
&lt;br /&gt;
To use this modes one must rename cache field in xml to owncache field and call JModuleHelper::ModuleCache from within the module&#039;s main php file. This is actually a shortcut to cache callback to avoid code duplication in every module. &lt;br /&gt;
&lt;br /&gt;
An example that uses safeuri mode and replaces uncached&lt;br /&gt;
$list = modRelatedItemsHelper::getList($params) : &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$cacheparams = new stdClass; &lt;br /&gt;
$cacheparams-&amp;gt;cachemode = &#039;safeuri&#039;; &lt;br /&gt;
$cacheparams-&amp;gt;class = &#039;modRelatedItemsHelper&#039;; &lt;br /&gt;
$cacheparams-&amp;gt;method = &#039;getList&#039;; &lt;br /&gt;
$cacheparams-&amp;gt;methodparams = $params; &lt;br /&gt;
$cacheparams-&amp;gt;modeparams = array(&#039;id&#039;=&amp;gt;&#039;int&#039;,&#039;Itemid&#039;=&amp;gt;&#039;int&#039;); &lt;br /&gt;
$list = JModuleHelper::ModuleCache ($module, $params, $cacheparams);&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
====Functional changes==== &lt;br /&gt;
&#039;&#039;&#039;Cache administration (Clean cache, Purge cache) now works with all drivers&#039;&#039;&#039;, not only with file cache. &lt;br /&gt;
&#039;&#039;&#039;New standalone garbage collect script&#039;&#039;&#039; that is to be called from crontab has been added. It can be found in libraries/joomla/utilities/garbagecron.php . For safety reasons it is recommended that it is renamed to something unique.&lt;br /&gt;
&lt;br /&gt;
====CMS and framework level functional changes==== &lt;br /&gt;
&#039;&#039;&#039;Caching is implemented in all components and modules&#039;&#039;&#039; that can potentially gain from cache.&lt;br /&gt;
Caching has also been added to some most expensive and frequent framework calls JComponentHelper::_load(), JModuleHelper::_load(),JMenuSite::load(); &lt;br /&gt;
&lt;br /&gt;
====Cache library changes====&lt;br /&gt;
Cache library has been completely refactored. &lt;br /&gt;
*Cache &#039;&#039;&#039;handlers have been renamed to controllers&#039;&#039;&#039; to better reflect their role and avoid confusion with cache storage handlers (referred to as drivers in following text). &lt;br /&gt;
*&#039;&#039;&#039;New JCacheController&#039;&#039;&#039; parent class has been added and inheritance has been changed to prevent bugs occurring from controller&#039;s and storage handler&#039;s get method clashes. &lt;br /&gt;
&lt;br /&gt;
====JCache==== &lt;br /&gt;
*&#039;&#039;&#039;getAll()&#039;&#039;&#039; method was added to JCache, JCacheStorage and all drivers, and it returns all cached items (this was previously possible only with file driver and hardcoded in administration) &lt;br /&gt;
*New &#039;&#039;&#039;lock and unlock&#039;&#039;&#039; methods were added to JCache, JCacheStorage and drivers. They enable cache item locking and unlocking to prevent errors on parallel accesses and double saves. This functionally was also implemented in controllers. &lt;br /&gt;
*Workarounds are now consolidated in new &#039;&#039;&#039;JCache getWorkarounds and setWorkarounds&#039;&#039;&#039; methods, are now used by all controllers and their use has been made optional. &lt;br /&gt;
*New makeId() method in JCache that creates cache id from registered url parameters set by components and system plugins&lt;br /&gt;
&lt;br /&gt;
====JCacheController==== &lt;br /&gt;
New parent class to Controllers that also functions as an intermediate to JCache. There is no JObject inheritance as otherwise magic __call doesn&#039;t work. &lt;br /&gt;
Change was needed to prevent bugs occurring from controller&#039;s and storage handler&#039;s get method clashes. They could be renamed but this would break backwards compatibility.&lt;br /&gt;
&lt;br /&gt;
====JCacheStorage==== &lt;br /&gt;
*_getCacheId method was moved from drivers to their parent JCacheStorage and all drives now use the same method by default &lt;br /&gt;
*CacheItem was moved from cache admin to framework JCacheStorageHelper, it is used by getAll &lt;br /&gt;
*There are new cachelite and wincache drivers. All other drivers have been fixed with missing functions (gc, clean) added, their code cleaned and tested they should be now working properly. &lt;br /&gt;
*Replaced separate _expire files in filecache driver with timestamps (this should amount to cca. 40% speed gain). The same in all drivers that had this. &lt;br /&gt;
*Numerous bugfixes on all levels, most important is proper use of options defaulting to configuration parameters settings and correctly passing from level to level.&lt;br /&gt;
&lt;br /&gt;
====Other framework level changes==== &lt;br /&gt;
*Safe url parameters registration added to JControler view method. &lt;br /&gt;
*New ModuleCache method in JModuleHelper that performs the above described module cache (in 5 modes) for both, modules and module renderer. &lt;br /&gt;
*JFactory::getFeedParser has been changed to use Joomla caching instead of simplepie&#039;s.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
===Eliminate the usage of JTable for general browsing on the frontend===&lt;br /&gt;
*Session drops the usage of JTable&lt;br /&gt;
*Item views use a dedicated question, not JTable-&amp;gt;load&lt;br /&gt;
&lt;br /&gt;
==Known Issues==&lt;br /&gt;
*Still Mootools 1.2. Will be upgrading to 1.3 during the beta process.&lt;br /&gt;
*Scaling issues to address&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
===Releases===&lt;br /&gt;
*Alpha 1: 22 June 2009&lt;br /&gt;
*Alpha 2: 25 October 2009&lt;br /&gt;
*Beta 1: 18 May 2010&lt;br /&gt;
*Beta 2: 31 May 2010&lt;br /&gt;
*Beta 3: 14 June 2010&lt;br /&gt;
*Beta 4: 28 June 2010&lt;br /&gt;
*Beta 5: 12 July 2010&lt;br /&gt;
*Beta 6: 26 July 2010&lt;br /&gt;
*Beta 7: 09 August 2010&lt;br /&gt;
&lt;br /&gt;
[[Category:Joomla! 1.6]]&lt;/div&gt;</summary>
		<author><name>Kissaki</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J1.5:Developing_a_MVC_Component/Adding_Backend_Actions&amp;diff=30641</id>
		<title>J1.5:Developing a MVC Component/Adding Backend Actions</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J1.5:Developing_a_MVC_Component/Adding_Backend_Actions&amp;diff=30641"/>
		<updated>2010-09-12T15:27:34Z</updated>

		<summary type="html">&lt;p&gt;Kissaki: /* The Hello Controller */ when the heck did the component change its name from hello to hellos???&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This article focuses on adding functionality to the current &#039;&#039;dumb&#039;&#039; page/article for the administrator. For an administrator the current default view is pretty useless. It doesn&#039;t really do anything - all it does is display the entries that we have in our database.&lt;br /&gt;
&lt;br /&gt;
In order to make it useful, we need to add some buttons and links. This article extends the component with content management tasks. Add, Change and Delete are the typical tasks that will be added.&lt;br /&gt;
&lt;br /&gt;
==Adding interaction ==&lt;br /&gt;
Interaction will be added on two levels. Within the administrator framework by means of Toolbar extension and within the article itself by means of reference links and form postings. For basic understanding see [[Developing a Model-View-Controller Component - Part 4 - Creating an Administrator Interface]].&lt;br /&gt;
&lt;br /&gt;
=== The Toolbar ===&lt;br /&gt;
&lt;br /&gt;
You may have noticed the toolbar that appears at the top of other Joomla! component administrator panels. Our component needs one as well. Joomla! makes this very easy to do. We will add buttons Delete records, Edit records, and create New records. We will also add a title that will be displayed on our toolbar.&lt;br /&gt;
&lt;br /&gt;
This is done by adding code to the view. To add the buttons, we use static methods from the Joomla! JToolBarHelper class. The code looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;JToolBarHelper::title(   JText::_( &#039;Hello Manager&#039; ), &#039;generic.png&#039; );&lt;br /&gt;
JToolBarHelper::deleteList();&lt;br /&gt;
JToolBarHelper::editListX();&lt;br /&gt;
JToolBarHelper::addNewX();&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These three methods will create the appropriate buttons. The deleteList() method can optionally take up to three parameters - the first parameter is a string to display to the user to confirm that they want to delete the records. The second is the task that should be sent with the query (the default is &#039;remove&#039;), and the third is the text that should be displayed below the button.&lt;br /&gt;
&lt;br /&gt;
The editListX() and addNewX() methods can each take two optional parameters. The first is the task (which are by default edit and add, respectively), and the second is the text that should be displayed below the button.&lt;br /&gt;
&lt;br /&gt;
*You may have noticed the use of the JText::_ method in the template before and here as well. This is a handy function that makes component translation much easier. The JText::_ method will look up the string in your component language file and return the translated string. If no translation text is found, it will return the string that you passed to it. If you want to translate your component into another language, all you have to do is create a language file that will map the strings within the quotes to the translated version of the string.&lt;br /&gt;
&lt;br /&gt;
=== Checkboxes and Links ===&lt;br /&gt;
&lt;br /&gt;
We now have buttons. Two of those buttons operate on existing records. But how do we know which records to operate on? We have to let the user tell us. To do this, we need to add checkboxes to our table so that the user can select certain records. This is done in our template.&lt;br /&gt;
&lt;br /&gt;
In order to the add the checkboxes, we need to add an extra column into our table. We will add the column in between the two that we already have.&lt;br /&gt;
&lt;br /&gt;
In the header of the column, we will add a checkbox which can be used to toggle all the boxes below it on or off:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;th width=&amp;quot;20&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input type=&amp;quot;checkbox&amp;quot; name=&amp;quot;toggle&amp;quot; value=&amp;quot;&amp;quot; onclick=&amp;quot;checkAll(&amp;lt;?php echo count( $this-&amp;gt;items ); ?&amp;gt;);&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/th&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Javascript checkAll function is a function that is built into the Joomla! base Javascript package that provides the functionality that we want here.&lt;br /&gt;
&lt;br /&gt;
Now we need to add the checkboxes into the individual rows. Joomla!&#039;s JHTML class has a method, JHTML::_(), which will generate our checkbox for us. We will add the following line to our loop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;$checked    = JHTML::_( &#039;grid.id&#039;, $i, $row-&amp;gt;id );&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
after the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;$row =&amp;amp; $this-&amp;gt;items[$i];&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we will add a cell in between the two that we already have:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
    &amp;lt;?php echo $checked; ?&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be cumbersome to have to check the box that we want to edit and then move up and click the edit button. Therefore, we will add a link so that it will go straight to the greeting&#039;s edit form. We will add the following line after the call to the JHTML::_() method to generate the link HTML:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;$link = JRoute::_( &#039;index.php?option=com_hello&amp;amp;controller=hello&amp;amp;task=edit&amp;amp;cid[]=&#039;. $row-&amp;gt;id );&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And we include the link in the cell showing the greeting text:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
    &amp;lt;a href=&amp;quot;&amp;lt;?php echo $link; ?&amp;gt;&amp;quot;&amp;gt;&amp;lt;?php echo $row-&amp;gt;greeting; ?&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that this link points to the hello controller. This controller will handle the data manipulation of our greetings.&lt;br /&gt;
&lt;br /&gt;
If you recall from above, we had four hidden input fields at the bottom of our form. The first input field was named &#039;option&#039;. This field is necessary so that we stay in our component. The second input field was task. This form property gets set when one of the buttons in the toolbar is clicked. A Javascript error will result and the buttons will not work if this input field is omitted. The third input field is the boxchecked field. This field keeps track of the number of boxes that are checked. The edit and delete buttons will check to ensure that this is greater than zero and will not allow the form to be submitted if it is not. The fourth input field is the controller field. This is used to specify that tasks fired from this form will be handled by the hello controller.&lt;br /&gt;
&lt;br /&gt;
Here is the code for the completed default.php file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;); ?&amp;gt;&lt;br /&gt;
&amp;lt;form action=&amp;quot;index.php&amp;quot; method=&amp;quot;post&amp;quot; name=&amp;quot;adminForm&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;editcell&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;table class=&amp;quot;adminlist&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;thead&amp;gt;&lt;br /&gt;
        &amp;lt;tr&amp;gt;&lt;br /&gt;
            &amp;lt;th width=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;?php echo JText::_( &#039;ID&#039; ); ?&amp;gt;&lt;br /&gt;
            &amp;lt;/th&amp;gt;&lt;br /&gt;
            &amp;lt;th width=&amp;quot;20&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;input type=&amp;quot;checkbox&amp;quot; name=&amp;quot;toggle&amp;quot; value=&amp;quot;&amp;quot; onclick=&amp;quot;checkAll(&amp;lt;?php echo count( $this-&amp;gt;items ); ?&amp;gt;);&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;/th&amp;gt;&lt;br /&gt;
            &amp;lt;th&amp;gt;&lt;br /&gt;
                &amp;lt;?php echo JText::_( &#039;Greeting&#039; ); ?&amp;gt;&lt;br /&gt;
            &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;            &lt;br /&gt;
    &amp;lt;/thead&amp;gt;&lt;br /&gt;
    &amp;lt;?php&lt;br /&gt;
    $k = 0;&lt;br /&gt;
    for ($i=0, $n=count( $this-&amp;gt;items ); $i &amp;lt; $n; $i++)&lt;br /&gt;
    {&lt;br /&gt;
        $row =&amp;amp; $this-&amp;gt;items[$i];&lt;br /&gt;
        $checked    = JHTML::_( &#039;grid.id&#039;, $i, $row-&amp;gt;id );&lt;br /&gt;
        $link = JRoute::_( &#039;index.php?option=com_hello&amp;amp;controller=hello&amp;amp;task=edit&amp;amp;cid[]=&#039;. $row-&amp;gt;id );&lt;br /&gt;
        &lt;br /&gt;
        ?&amp;gt;&lt;br /&gt;
        &amp;lt;tr class=&amp;quot;&amp;lt;?php echo &amp;quot;row$k&amp;quot;; ?&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;&lt;br /&gt;
                &amp;lt;?php echo $row-&amp;gt;id; ?&amp;gt;&lt;br /&gt;
            &amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;&lt;br /&gt;
              &amp;lt;?php echo $checked; ?&amp;gt;&lt;br /&gt;
            &amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;&lt;br /&gt;
                &amp;lt;a href=&amp;quot;&amp;lt;?php echo $link; ?&amp;gt;&amp;quot;&amp;gt;&amp;lt;?php echo $row-&amp;gt;greeting; ?&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
            &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;?php&lt;br /&gt;
        $k = 1 - $k;&lt;br /&gt;
    }&lt;br /&gt;
    ?&amp;gt;&lt;br /&gt;
    &amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;option&amp;quot; value=&amp;quot;com_hello&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;task&amp;quot; value=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;boxchecked&amp;quot; value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;controller&amp;quot; value=&amp;quot;hello&amp;quot; /&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/form&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Our hellos view is now complete.&lt;br /&gt;
&lt;br /&gt;
== Getting Down and Dirty: Doing the Real Work ==&lt;br /&gt;
&lt;br /&gt;
Now that the Hellos view is done, it is time to move to the Hello controller and model. This is where the real work will get done.&lt;br /&gt;
&lt;br /&gt;
==== The Hello Controller ====&lt;br /&gt;
&lt;br /&gt;
Our default controller just isn&#039;t going to cut it when it comes to doing work - all it is capable of doing is displaying views.&lt;br /&gt;
&lt;br /&gt;
We need to be able to handle the tasks that we are launching from the Hellos view: add, edit and remove. The singular named Hello controller is created (and located in the controllers sub-directory) to actually add, edit and remove the individual entries.&lt;br /&gt;
&lt;br /&gt;
Add and edit are essentially the same task: they both display a form to the user that allows a greeting to be edited. The only difference is that new displays a blank form, and edit displays a form with data already in it. Since they are similar, we will map the add task onto the edit task handler. This is specified in our constructor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * constructor (registers additional tasks to methods)&lt;br /&gt;
 * @return void&lt;br /&gt;
 */&lt;br /&gt;
function __construct()&lt;br /&gt;
{&lt;br /&gt;
    parent::__construct();&lt;br /&gt;
&lt;br /&gt;
    // Register Extra tasks&lt;br /&gt;
    $this-&amp;gt;registerTask( &#039;add&#039;, &#039;edit&#039; );&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first parameter of JController::registerTask is the task to map, and the second is the method to map it to.&lt;br /&gt;
&lt;br /&gt;
We will start with handling the edit task. The controller&#039;s job is fairly simple for the edit task. All it has to do is specify the view and layout to load (the hello view and the form layout). We will also tell Joomla! to disable the mainmenu while we are editing our greeting. This prevents users from leaving unsaved records open.&lt;br /&gt;
&lt;br /&gt;
Our edit task handler looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * display the edit form&lt;br /&gt;
 * @return void&lt;br /&gt;
 */&lt;br /&gt;
function edit()&lt;br /&gt;
{&lt;br /&gt;
    JRequest::setVar( &#039;view&#039;, &#039;hello&#039; );&lt;br /&gt;
    JRequest::setVar( &#039;layout&#039;, &#039;form&#039;  );&lt;br /&gt;
    JRequest::setVar( &#039;hidemainmenu&#039;, 1 );&lt;br /&gt;
&lt;br /&gt;
    parent::display();&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE on naming conventions:  The top calling program (hello.php) makes assumptions about the file names and class names of the controllers.  To summarize for this example: &lt;br /&gt;
&lt;br /&gt;
   Default controller path:    …/controller.php&lt;br /&gt;
   Default controller class name:  HellosController&lt;br /&gt;
&lt;br /&gt;
   Requested controller path …/controllers/&amp;lt;requestName&amp;gt;.php&lt;br /&gt;
   Requested controller class name:  HellosController&amp;lt;requestName&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The code for the controller at admin/controllers/hello.php:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Controller for Hello World Component&lt;br /&gt;
 * &lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_4&lt;br /&gt;
 * @license		GNU/GPL&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access&lt;br /&gt;
defined( &#039;_JEXEC&#039; ) or die( &#039;Restricted access&#039; );&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Hello Controller&lt;br /&gt;
 *&lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 */&lt;br /&gt;
class HellosControllerHello extends HellosController&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * constructor (registers additional tasks to methods)&lt;br /&gt;
	 * @return void&lt;br /&gt;
	 */&lt;br /&gt;
	function __construct()&lt;br /&gt;
	{&lt;br /&gt;
		parent::__construct();&lt;br /&gt;
&lt;br /&gt;
		// Register Extra tasks&lt;br /&gt;
		$this-&amp;gt;registerTask( &#039;add&#039;  , 	&#039;edit&#039; );&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * display the edit form&lt;br /&gt;
	 * @return void&lt;br /&gt;
	 */&lt;br /&gt;
	function edit()&lt;br /&gt;
	{&lt;br /&gt;
		JRequest::setVar( &#039;view&#039;, &#039;hello&#039; );&lt;br /&gt;
		JRequest::setVar( &#039;layout&#039;, &#039;form&#039;  );&lt;br /&gt;
		JRequest::setVar(&#039;hidemainmenu&#039;, 1);&lt;br /&gt;
&lt;br /&gt;
		parent::display();&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Hello View ====&lt;br /&gt;
&lt;br /&gt;
The Hello view will display a form which will allow the user to edit a greeting. The display method if the hello view has to do a few simple tasks:&lt;br /&gt;
&lt;br /&gt;
* retrieve the data from the model&lt;br /&gt;
* create the toolbar&lt;br /&gt;
* pass the data into the template&lt;br /&gt;
* invoke the display() method to render the template&lt;br /&gt;
&lt;br /&gt;
This becomes a bit more complicated because the one view handles both the edit and add tasks. In our toolbar we want the user to know whether they are adding or editing, so we have to determine which task was fired.&lt;br /&gt;
&lt;br /&gt;
Since we are already retrieving the record that we want to display from the model, we can use this data to determine what task was fired. If the task was edit, then the id field of our record will have been set. If the task was new, then it will not have been set. This can be used to determine if we have a new record or an existing record.&lt;br /&gt;
&lt;br /&gt;
We will add two buttons to the toolbar: save and cancel. Though the functionality will be the same, we want to display different buttons depending on whether it is a new or existing record. If it is a new record, we will display cancel. If it already exists, we will display close.&lt;br /&gt;
&lt;br /&gt;
Thus our display method looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * display method of Hello view&lt;br /&gt;
 * @return void&lt;br /&gt;
 **/&lt;br /&gt;
function display($tpl = null)&lt;br /&gt;
{&lt;br /&gt;
    //get the hello&lt;br /&gt;
    $hello        =&amp;amp; $this-&amp;gt;get(&#039;Data&#039;);&lt;br /&gt;
    $isNew        = ($hello-&amp;gt;id &amp;lt; 1);&lt;br /&gt;
&lt;br /&gt;
    $text = $isNew ? JText::_( &#039;New&#039; ) : JText::_( &#039;Edit&#039; );&lt;br /&gt;
    JToolBarHelper::title(   JText::_( &#039;Hello&#039; ).&#039;: &amp;lt;small&amp;gt;&amp;lt;small&amp;gt;[ &#039; . $text.&#039; ]&amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt;&#039; );&lt;br /&gt;
    JToolBarHelper::save();&lt;br /&gt;
    if ($isNew)  {&lt;br /&gt;
        JToolBarHelper::cancel();&lt;br /&gt;
    } else {&lt;br /&gt;
        // for existing items the button is renamed `close`&lt;br /&gt;
        JToolBarHelper::cancel( &#039;cancel&#039;, &#039;Close&#039; );&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    $this-&amp;gt;assignRef(&#039;hello&#039;, $hello);&lt;br /&gt;
    parent::display($tpl);&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The code for the view at admin/views/hello/view.html.php:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * Hello View for Hello World Component&lt;br /&gt;
 * &lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_4&lt;br /&gt;
 * @license		GNU/GPL&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access&lt;br /&gt;
defined( &#039;_JEXEC&#039; ) or die( &#039;Restricted access&#039; );&lt;br /&gt;
&lt;br /&gt;
jimport( &#039;joomla.application.component.view&#039; );&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello View&lt;br /&gt;
 *&lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 */&lt;br /&gt;
class HellosViewHello extends JView&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * display method of Hello view&lt;br /&gt;
	 * @return void&lt;br /&gt;
	 **/&lt;br /&gt;
	function display($tpl = null)&lt;br /&gt;
	{&lt;br /&gt;
		//get the hello&lt;br /&gt;
		$hello		=&amp;amp; $this-&amp;gt;get(&#039;Data&#039;);&lt;br /&gt;
		$isNew		= ($hello-&amp;gt;id &amp;lt; 1);&lt;br /&gt;
&lt;br /&gt;
		$text = $isNew ? JText::_( &#039;New&#039; ) : JText::_( &#039;Edit&#039; );&lt;br /&gt;
		JToolBarHelper::title(   JText::_( &#039;Hello&#039; ).&#039;: &amp;lt;small&amp;gt;&amp;lt;small&amp;gt;[ &#039; . $text.&#039; ]&amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt;&#039; );&lt;br /&gt;
		JToolBarHelper::save();&lt;br /&gt;
		if ($isNew)  {&lt;br /&gt;
			JToolBarHelper::cancel();&lt;br /&gt;
		} else {&lt;br /&gt;
			// for existing items the button is renamed `close`&lt;br /&gt;
			JToolBarHelper::cancel( &#039;cancel&#039;, &#039;Close&#039; );&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$this-&amp;gt;assignRef(&#039;hello&#039;,		$hello);&lt;br /&gt;
&lt;br /&gt;
		parent::display($tpl);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Hello Model ====&lt;br /&gt;
&lt;br /&gt;
Our view needs data. Therefore, we need to create a model to model a hello.&lt;br /&gt;
&lt;br /&gt;
Our model will have two properties: _id and _data. _id will hold the id of the greeting and data will hold the data.&lt;br /&gt;
&lt;br /&gt;
We will start with a constructor, which will attempt to retrieve the id from the query:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * Constructor that retrieves the ID from the request&lt;br /&gt;
 *&lt;br /&gt;
 * @access    public&lt;br /&gt;
 * @return    void&lt;br /&gt;
 */&lt;br /&gt;
function __construct()&lt;br /&gt;
{&lt;br /&gt;
    parent::__construct();&lt;br /&gt;
&lt;br /&gt;
    $array = JRequest::getVar(&#039;cid&#039;,  0, &#039;&#039;, &#039;array&#039;);&lt;br /&gt;
    $this-&amp;gt;setId((int)$array[0]);&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The JRequest::getVar() method is used to retrieve data from the request. The first parameter is the name of the form variable. The second parameter is the default value to assign if there is no value found. The third parameter is the name of the hash to retrieve the value from (get, post, etc), and the last value is the data type that should be forced on the value.&lt;br /&gt;
&lt;br /&gt;
Our constructor will take the first value from the cid array and assign it to the id.&lt;br /&gt;
&lt;br /&gt;
Our setId() method can be used to set our id. Changing the id that our model points to will mean the id points to the wrong data. Therefore, when we set the id, we will clear the data property:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * Method to set the hello identifier&lt;br /&gt;
 *&lt;br /&gt;
 * @access    public&lt;br /&gt;
 * @param    int Hello identifier&lt;br /&gt;
 * @return    void&lt;br /&gt;
 */&lt;br /&gt;
function setId($id)&lt;br /&gt;
{&lt;br /&gt;
    // Set id and wipe data&lt;br /&gt;
    $this-&amp;gt;_id        = $id;&lt;br /&gt;
    $this-&amp;gt;_data    = null;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we need a method to retrieve our data: getData()&lt;br /&gt;
&lt;br /&gt;
getData will check if the _data property has already been set. If it has, it will simply return it. Otherwise, it will load the data from the database.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * Method to get a hello&lt;br /&gt;
 * @return object with data&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
function &amp;amp;getData()&lt;br /&gt;
{&lt;br /&gt;
    // Load the data&lt;br /&gt;
    if (empty( $this-&amp;gt;_data )) {&lt;br /&gt;
        $query = &#039; SELECT * FROM #__hello &#039;.&lt;br /&gt;
                &#039;  WHERE id = &#039;.$this-&amp;gt;_id;&lt;br /&gt;
        $this-&amp;gt;_db-&amp;gt;setQuery( $query );&lt;br /&gt;
        $this-&amp;gt;_data = $this-&amp;gt;_db-&amp;gt;loadObject();&lt;br /&gt;
    }&lt;br /&gt;
    if (!$this-&amp;gt;_data) {&lt;br /&gt;
        $this-&amp;gt;_data = new stdClass();&lt;br /&gt;
        $this-&amp;gt;_data-&amp;gt;id = 0;&lt;br /&gt;
        $this-&amp;gt;_data-&amp;gt;greeting = null;&lt;br /&gt;
    }&lt;br /&gt;
    return $this-&amp;gt;_data;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Form ====&lt;br /&gt;
&lt;br /&gt;
Now all that is left is to create the form that the data will go into. Since we specified our layout as form, the form will go in a file in the tmpl directory of the hello view called form.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;); ?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;form action=&amp;quot;index.php&amp;quot; method=&amp;quot;post&amp;quot; name=&amp;quot;adminForm&amp;quot; id=&amp;quot;adminForm&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;col100&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;fieldset class=&amp;quot;adminform&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;legend&amp;gt;&amp;lt;?php echo JText::_( &#039;Details&#039; ); ?&amp;gt;&amp;lt;/legend&amp;gt;&lt;br /&gt;
        &amp;lt;table class=&amp;quot;admintable&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;tr&amp;gt;&lt;br /&gt;
            &amp;lt;td width=&amp;quot;100&amp;quot; align=&amp;quot;right&amp;quot; class=&amp;quot;key&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;label for=&amp;quot;greeting&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;?php echo JText::_( &#039;Greeting&#039; ); ?&amp;gt;:&lt;br /&gt;
                &amp;lt;/label&amp;gt;&lt;br /&gt;
            &amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;&lt;br /&gt;
                &amp;lt;input class=&amp;quot;text_area&amp;quot; type=&amp;quot;text&amp;quot; name=&amp;quot;greeting&amp;quot; id=&amp;quot;greeting&amp;quot; size=&amp;quot;32&amp;quot; maxlength=&amp;quot;250&amp;quot; value=&amp;quot;&amp;lt;?php echo $this-&amp;gt;hello-&amp;gt;greeting;?&amp;gt;&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;/table&amp;gt;&lt;br /&gt;
    &amp;lt;/fieldset&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;clr&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;option&amp;quot; value=&amp;quot;com_hello&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;id&amp;quot; value=&amp;quot;&amp;lt;?php echo $this-&amp;gt;hello-&amp;gt;id; ?&amp;gt;&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;task&amp;quot; value=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;controller&amp;quot; value=&amp;quot;hello&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that in addition to the input field, there is a hidden field for the id. The user doesn&#039;t need to edit the id (and shouldn&#039;t), so we silently pass it along in the form.&lt;br /&gt;
&lt;br /&gt;
==== Implementing the Functionality ====&lt;br /&gt;
&lt;br /&gt;
So far, our controller only handles two tasks: edit and new. However, we also have buttons to save, delete and cancel records. We need to write code to handle and perform these tasks.&lt;br /&gt;
&lt;br /&gt;
=== Saving a Record ===&lt;br /&gt;
&lt;br /&gt;
The logical next step is to implement the functionality to save a record. Normally, this would require some switches and logic to handle various cases, such as the difference between creating a new record (an INSERT query), and updating an existing query (an UPDATE query). Also, there are complexities involved in getting the data from the form and putting it into the query.&lt;br /&gt;
&lt;br /&gt;
The Joomla! framework takes care of a lot of this for you. The JTable class makes it easy to manipulate records in the database without having to worry about writing the SQL code that lies behind these updates. It also makes it easy to transfer data from an HTML form into the database.&lt;br /&gt;
&lt;br /&gt;
== Creating the Table Class ==&lt;br /&gt;
&lt;br /&gt;
The JTable class is an abstract class from which you can derive child classes to work with specific tables. To use it, you simply create a class that extends the JTable class, add your database fields as properties, and override the constructor to specify the name of the table and the primary key.&lt;br /&gt;
&lt;br /&gt;
Here is our JTable class:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * Hello World table class&lt;br /&gt;
 * &lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_4&lt;br /&gt;
 * @license        GNU/GPL&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Table class&lt;br /&gt;
 *&lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 */&lt;br /&gt;
class TableHello extends JTable&lt;br /&gt;
{&lt;br /&gt;
    /**&lt;br /&gt;
     * Primary Key&lt;br /&gt;
     *&lt;br /&gt;
     * @var int&lt;br /&gt;
     */&lt;br /&gt;
    var $id = null;&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * @var string&lt;br /&gt;
     */&lt;br /&gt;
    var $greeting = null;&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Constructor&lt;br /&gt;
     *&lt;br /&gt;
     * @param object Database connector object&lt;br /&gt;
     */&lt;br /&gt;
    function __construct( &amp;amp;$db ) {&lt;br /&gt;
        parent::__construct(&#039;#__hello&#039;, &#039;id&#039;, $db);&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see here that we have defined our two fields: the id field and the greeting field. Then we have defined a constructor, which will call the constructor of the parent class and pass it the name of the table (hello), the name of the field which is the primary key (id), and the database connector object.&lt;br /&gt;
&lt;br /&gt;
This file should be called hello.php and it will go in a directory called tables in the administrator section of our component.&lt;br /&gt;
&lt;br /&gt;
== Implementing the Function in our Model ==&lt;br /&gt;
&lt;br /&gt;
We are now ready to add the method to the model which will save our record. We will call this method store. Our store() method will do three things: bind the data from the form to the TableHello object, check to ensure that the record is properly formed, and store the record in the database.&lt;br /&gt;
&lt;br /&gt;
Our method looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * Method to store a record&lt;br /&gt;
 *&lt;br /&gt;
 * @access    public&lt;br /&gt;
 * @return    boolean    True on success&lt;br /&gt;
 */&lt;br /&gt;
function store()&lt;br /&gt;
{&lt;br /&gt;
    $row =&amp;amp; $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
    $data = JRequest::get( &#039;post&#039; );&lt;br /&gt;
    // Bind the form fields to the hello table&lt;br /&gt;
    if (!$row-&amp;gt;bind($data)) {&lt;br /&gt;
        $this-&amp;gt;setError($this-&amp;gt;_db-&amp;gt;getErrorMsg());&lt;br /&gt;
        return false;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Make sure the hello record is valid&lt;br /&gt;
    if (!$row-&amp;gt;check()) {&lt;br /&gt;
        $this-&amp;gt;setError($this-&amp;gt;_db-&amp;gt;getErrorMsg());&lt;br /&gt;
        return false;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Store the web link table to the database&lt;br /&gt;
    if (!$row-&amp;gt;store()) {&lt;br /&gt;
        $this-&amp;gt;setError($this-&amp;gt;_db-&amp;gt;getErrorMsg());&lt;br /&gt;
        return false;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return true;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method gets added to the hello model.&lt;br /&gt;
&lt;br /&gt;
The method takes one parameter, which is an associative array of data that we want to store in the database. This can easily be retrieved from the request as will be seen later.&lt;br /&gt;
&lt;br /&gt;
You will see that the first line retrieves a reference to our JTable object. If we name our table properly, we don&#039;t have to specify its name - the JModel class knows where to find it. You may recall that we called our table class TableHello and put it in a file called hello.php in the tables directory. If you follow this convention, the JModel class can create your object automatically.&lt;br /&gt;
&lt;br /&gt;
The second line will retrieve the data from the form. The JRequest class makes this very easy. In this case, we are retrieving all of the variables that were submitted using the &#039;POST&#039; method. These will be returned as an associative array.&lt;br /&gt;
&lt;br /&gt;
The rest is easy - we bind, check and store. The [http://docs.joomla.org/API15:JTable/bind bind()] method will copy values from the array into the corresponding property of the table object. In this case, it will take the values of id and greeting and copy them to our TableHello object.&lt;br /&gt;
&lt;br /&gt;
The [http://docs.joomla.org/API15:JTable/check check()] method will perform data verification. In the JTable() class, this method simply returns true. While this doesn&#039;t provide any value for us currently, by calling this method we make it possible to do data checking using our TableHello class in the future. This method can be overridden in our TableHello class with a method that performs the appropriate checks.&lt;br /&gt;
&lt;br /&gt;
The [http://docs.joomla.org/API15:JTable/store store()] method will take the data that is in the object and store it in the database. If the id is 0, it will create a new record (INSERT), otherwise, it will update the existing record (UPDATE).&lt;br /&gt;
&lt;br /&gt;
== Adding the Task to the Controller ==&lt;br /&gt;
&lt;br /&gt;
We are now ready to add our task to the controller. Since the task that we are firing is called &#039;save&#039;, we must call our method &#039;save&#039;. This is simple:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * save a record (and redirect to main page)&lt;br /&gt;
 * @return void&lt;br /&gt;
 */&lt;br /&gt;
function save()&lt;br /&gt;
{&lt;br /&gt;
    $model = $this-&amp;gt;getModel(&#039;hello&#039;);&lt;br /&gt;
&lt;br /&gt;
    if ($model-&amp;gt;store()) {&lt;br /&gt;
        $msg = JText::_( &#039;Greeting Saved!&#039; );&lt;br /&gt;
    } else {&lt;br /&gt;
        $msg = JText::_( &#039;Error Saving Greeting&#039; );&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Check the table in so it can be edited.... we are done with it anyway&lt;br /&gt;
    $link = &#039;index.php?option=com_hello&#039;;&lt;br /&gt;
    $this-&amp;gt;setRedirect($link, $msg);&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All we do is get our model and invoke the store() method. Then we use the setRedirect() method to redirect back to our list of greetings. We also pass a message along, which will be displayed at the top of the page.&lt;br /&gt;
&lt;br /&gt;
=== Deleting a Record ===&lt;br /&gt;
&lt;br /&gt;
=== Implementing the Function in the Model ===&lt;br /&gt;
&lt;br /&gt;
In the model, we will retrieve the list of IDs to delete and call the JTable class to delete them. Here it is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * Method to delete record(s)&lt;br /&gt;
 *&lt;br /&gt;
 * @access    public&lt;br /&gt;
 * @return    boolean    True on success&lt;br /&gt;
 */&lt;br /&gt;
function delete()&lt;br /&gt;
{&lt;br /&gt;
    $cids = JRequest::getVar( &#039;cid&#039;, array(0), &#039;post&#039;, &#039;array&#039; );&lt;br /&gt;
    $row =&amp;amp; $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
    foreach($cids as $cid) {&lt;br /&gt;
        if (!$row-&amp;gt;delete( $cid )) {&lt;br /&gt;
            $this-&amp;gt;setError( $row-&amp;gt;getErrorMsg() );&lt;br /&gt;
            return false;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return true;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We invoke the JRequest::getVar() method to get the data from the request, then we invoke the $row-&amp;gt;delete() method to delete each row. By storing errors in the model we make it possible to retrieve them later if we so choose.&lt;br /&gt;
&lt;br /&gt;
=== Handling the Remove Task in the Controller ===&lt;br /&gt;
&lt;br /&gt;
This is similar to the save() method which handled the save task:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * remove record(s)&lt;br /&gt;
 * @return void&lt;br /&gt;
 */&lt;br /&gt;
function remove()&lt;br /&gt;
{&lt;br /&gt;
    $model = $this-&amp;gt;getModel(&#039;hello&#039;);&lt;br /&gt;
    if(!$model-&amp;gt;delete()) {&lt;br /&gt;
        $msg = JText::_( &#039;Error: One or More Greetings Could not be Deleted&#039; );&lt;br /&gt;
    } else {&lt;br /&gt;
        $msg = JText::_( &#039;Greeting(s) Deleted&#039; );&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    $this-&amp;gt;setRedirect( &#039;index.php?option=com_hello&#039;, $msg );&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Cancelling the Edit Operation ====&lt;br /&gt;
&lt;br /&gt;
To cancel the edit operation, all we have to do is redirect back to the main view:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * cancel editing a record&lt;br /&gt;
 * @return void&lt;br /&gt;
 */&lt;br /&gt;
function cancel()&lt;br /&gt;
{&lt;br /&gt;
    $msg = JText::_( &#039;Operation Cancelled&#039; );&lt;br /&gt;
    $this-&amp;gt;setRedirect( &#039;index.php?option=com_hello&#039;, $msg );&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
We have now implemented a basic backend to our component. We are now able to edit the entries that are viewed in the frontend. We have demonstrated the interaction between models, views and controllers. We have shown how the JTable class can be extended to provide easy access to tables in the database. It can also be seen how the JToolBarHelper class can be used to create button bars in components to present a standardized look between components.&lt;br /&gt;
&lt;br /&gt;
== Articles in this Series ==&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 1]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 2 - Adding a Model]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 3 - Using the Database]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 4 - Creating an Administrator Interface]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 5 - Basic Backend Framework]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 6 - Adding Backend Actions]]&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
* staalanden&lt;br /&gt;
* jamesconroyuk&lt;br /&gt;
&lt;br /&gt;
== Download ==&lt;br /&gt;
&lt;br /&gt;
The component can be downloaded at: [http://joomlacode.org/gf/download/frsrelease/8111/29436/com_hello4_01.zip com_hello4_01]&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Kissaki</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J1.5:Developing_a_MVC_Component/Adding_Backend_Actions&amp;diff=30640</id>
		<title>J1.5:Developing a MVC Component/Adding Backend Actions</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J1.5:Developing_a_MVC_Component/Adding_Backend_Actions&amp;diff=30640"/>
		<updated>2010-09-12T15:24:45Z</updated>

		<summary type="html">&lt;p&gt;Kissaki: /* The Hello Controller */ csty&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This article focuses on adding functionality to the current &#039;&#039;dumb&#039;&#039; page/article for the administrator. For an administrator the current default view is pretty useless. It doesn&#039;t really do anything - all it does is display the entries that we have in our database.&lt;br /&gt;
&lt;br /&gt;
In order to make it useful, we need to add some buttons and links. This article extends the component with content management tasks. Add, Change and Delete are the typical tasks that will be added.&lt;br /&gt;
&lt;br /&gt;
==Adding interaction ==&lt;br /&gt;
Interaction will be added on two levels. Within the administrator framework by means of Toolbar extension and within the article itself by means of reference links and form postings. For basic understanding see [[Developing a Model-View-Controller Component - Part 4 - Creating an Administrator Interface]].&lt;br /&gt;
&lt;br /&gt;
=== The Toolbar ===&lt;br /&gt;
&lt;br /&gt;
You may have noticed the toolbar that appears at the top of other Joomla! component administrator panels. Our component needs one as well. Joomla! makes this very easy to do. We will add buttons Delete records, Edit records, and create New records. We will also add a title that will be displayed on our toolbar.&lt;br /&gt;
&lt;br /&gt;
This is done by adding code to the view. To add the buttons, we use static methods from the Joomla! JToolBarHelper class. The code looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;JToolBarHelper::title(   JText::_( &#039;Hello Manager&#039; ), &#039;generic.png&#039; );&lt;br /&gt;
JToolBarHelper::deleteList();&lt;br /&gt;
JToolBarHelper::editListX();&lt;br /&gt;
JToolBarHelper::addNewX();&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These three methods will create the appropriate buttons. The deleteList() method can optionally take up to three parameters - the first parameter is a string to display to the user to confirm that they want to delete the records. The second is the task that should be sent with the query (the default is &#039;remove&#039;), and the third is the text that should be displayed below the button.&lt;br /&gt;
&lt;br /&gt;
The editListX() and addNewX() methods can each take two optional parameters. The first is the task (which are by default edit and add, respectively), and the second is the text that should be displayed below the button.&lt;br /&gt;
&lt;br /&gt;
*You may have noticed the use of the JText::_ method in the template before and here as well. This is a handy function that makes component translation much easier. The JText::_ method will look up the string in your component language file and return the translated string. If no translation text is found, it will return the string that you passed to it. If you want to translate your component into another language, all you have to do is create a language file that will map the strings within the quotes to the translated version of the string.&lt;br /&gt;
&lt;br /&gt;
=== Checkboxes and Links ===&lt;br /&gt;
&lt;br /&gt;
We now have buttons. Two of those buttons operate on existing records. But how do we know which records to operate on? We have to let the user tell us. To do this, we need to add checkboxes to our table so that the user can select certain records. This is done in our template.&lt;br /&gt;
&lt;br /&gt;
In order to the add the checkboxes, we need to add an extra column into our table. We will add the column in between the two that we already have.&lt;br /&gt;
&lt;br /&gt;
In the header of the column, we will add a checkbox which can be used to toggle all the boxes below it on or off:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;th width=&amp;quot;20&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input type=&amp;quot;checkbox&amp;quot; name=&amp;quot;toggle&amp;quot; value=&amp;quot;&amp;quot; onclick=&amp;quot;checkAll(&amp;lt;?php echo count( $this-&amp;gt;items ); ?&amp;gt;);&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/th&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Javascript checkAll function is a function that is built into the Joomla! base Javascript package that provides the functionality that we want here.&lt;br /&gt;
&lt;br /&gt;
Now we need to add the checkboxes into the individual rows. Joomla!&#039;s JHTML class has a method, JHTML::_(), which will generate our checkbox for us. We will add the following line to our loop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;$checked    = JHTML::_( &#039;grid.id&#039;, $i, $row-&amp;gt;id );&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
after the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;$row =&amp;amp; $this-&amp;gt;items[$i];&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we will add a cell in between the two that we already have:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
    &amp;lt;?php echo $checked; ?&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be cumbersome to have to check the box that we want to edit and then move up and click the edit button. Therefore, we will add a link so that it will go straight to the greeting&#039;s edit form. We will add the following line after the call to the JHTML::_() method to generate the link HTML:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;$link = JRoute::_( &#039;index.php?option=com_hello&amp;amp;controller=hello&amp;amp;task=edit&amp;amp;cid[]=&#039;. $row-&amp;gt;id );&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And we include the link in the cell showing the greeting text:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
    &amp;lt;a href=&amp;quot;&amp;lt;?php echo $link; ?&amp;gt;&amp;quot;&amp;gt;&amp;lt;?php echo $row-&amp;gt;greeting; ?&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that this link points to the hello controller. This controller will handle the data manipulation of our greetings.&lt;br /&gt;
&lt;br /&gt;
If you recall from above, we had four hidden input fields at the bottom of our form. The first input field was named &#039;option&#039;. This field is necessary so that we stay in our component. The second input field was task. This form property gets set when one of the buttons in the toolbar is clicked. A Javascript error will result and the buttons will not work if this input field is omitted. The third input field is the boxchecked field. This field keeps track of the number of boxes that are checked. The edit and delete buttons will check to ensure that this is greater than zero and will not allow the form to be submitted if it is not. The fourth input field is the controller field. This is used to specify that tasks fired from this form will be handled by the hello controller.&lt;br /&gt;
&lt;br /&gt;
Here is the code for the completed default.php file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;); ?&amp;gt;&lt;br /&gt;
&amp;lt;form action=&amp;quot;index.php&amp;quot; method=&amp;quot;post&amp;quot; name=&amp;quot;adminForm&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;editcell&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;table class=&amp;quot;adminlist&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;thead&amp;gt;&lt;br /&gt;
        &amp;lt;tr&amp;gt;&lt;br /&gt;
            &amp;lt;th width=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;?php echo JText::_( &#039;ID&#039; ); ?&amp;gt;&lt;br /&gt;
            &amp;lt;/th&amp;gt;&lt;br /&gt;
            &amp;lt;th width=&amp;quot;20&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;input type=&amp;quot;checkbox&amp;quot; name=&amp;quot;toggle&amp;quot; value=&amp;quot;&amp;quot; onclick=&amp;quot;checkAll(&amp;lt;?php echo count( $this-&amp;gt;items ); ?&amp;gt;);&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;/th&amp;gt;&lt;br /&gt;
            &amp;lt;th&amp;gt;&lt;br /&gt;
                &amp;lt;?php echo JText::_( &#039;Greeting&#039; ); ?&amp;gt;&lt;br /&gt;
            &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;            &lt;br /&gt;
    &amp;lt;/thead&amp;gt;&lt;br /&gt;
    &amp;lt;?php&lt;br /&gt;
    $k = 0;&lt;br /&gt;
    for ($i=0, $n=count( $this-&amp;gt;items ); $i &amp;lt; $n; $i++)&lt;br /&gt;
    {&lt;br /&gt;
        $row =&amp;amp; $this-&amp;gt;items[$i];&lt;br /&gt;
        $checked    = JHTML::_( &#039;grid.id&#039;, $i, $row-&amp;gt;id );&lt;br /&gt;
        $link = JRoute::_( &#039;index.php?option=com_hello&amp;amp;controller=hello&amp;amp;task=edit&amp;amp;cid[]=&#039;. $row-&amp;gt;id );&lt;br /&gt;
        &lt;br /&gt;
        ?&amp;gt;&lt;br /&gt;
        &amp;lt;tr class=&amp;quot;&amp;lt;?php echo &amp;quot;row$k&amp;quot;; ?&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;&lt;br /&gt;
                &amp;lt;?php echo $row-&amp;gt;id; ?&amp;gt;&lt;br /&gt;
            &amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;&lt;br /&gt;
              &amp;lt;?php echo $checked; ?&amp;gt;&lt;br /&gt;
            &amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;&lt;br /&gt;
                &amp;lt;a href=&amp;quot;&amp;lt;?php echo $link; ?&amp;gt;&amp;quot;&amp;gt;&amp;lt;?php echo $row-&amp;gt;greeting; ?&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
            &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;?php&lt;br /&gt;
        $k = 1 - $k;&lt;br /&gt;
    }&lt;br /&gt;
    ?&amp;gt;&lt;br /&gt;
    &amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;option&amp;quot; value=&amp;quot;com_hello&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;task&amp;quot; value=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;boxchecked&amp;quot; value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;controller&amp;quot; value=&amp;quot;hello&amp;quot; /&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/form&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Our hellos view is now complete.&lt;br /&gt;
&lt;br /&gt;
== Getting Down and Dirty: Doing the Real Work ==&lt;br /&gt;
&lt;br /&gt;
Now that the Hellos view is done, it is time to move to the Hello controller and model. This is where the real work will get done.&lt;br /&gt;
&lt;br /&gt;
==== The Hello Controller ====&lt;br /&gt;
&lt;br /&gt;
Our default controller just isn&#039;t going to cut it when it comes to doing work - all it is capable of doing is displaying views.&lt;br /&gt;
&lt;br /&gt;
We need to be able to handle the tasks that we are launching from the Hellos view: add, edit and remove. The singular named Hello controller is created (and located in the controllers sub-directory) to actually add, edit and remove the individual entries.&lt;br /&gt;
&lt;br /&gt;
Add and edit are essentially the same task: they both display a form to the user that allows a greeting to be edited. The only difference is that new displays a blank form, and edit displays a form with data already in it. Since they are similar, we will map the add task onto the edit task handler. This is specified in our constructor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * constructor (registers additional tasks to methods)&lt;br /&gt;
 * @return void&lt;br /&gt;
 */&lt;br /&gt;
function __construct()&lt;br /&gt;
{&lt;br /&gt;
    parent::__construct();&lt;br /&gt;
&lt;br /&gt;
    // Register Extra tasks&lt;br /&gt;
    $this-&amp;gt;registerTask( &#039;add&#039;, &#039;edit&#039; );&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first parameter of JController::registerTask is the task to map, and the second is the method to map it to.&lt;br /&gt;
&lt;br /&gt;
We will start with handling the edit task. The controller&#039;s job is fairly simple for the edit task. All it has to do is specify the view and layout to load (the hello view and the form layout). We will also tell Joomla! to disable the mainmenu while we are editing our greeting. This prevents users from leaving unsaved records open.&lt;br /&gt;
&lt;br /&gt;
Our edit task handler looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * display the edit form&lt;br /&gt;
 * @return void&lt;br /&gt;
 */&lt;br /&gt;
function edit()&lt;br /&gt;
{&lt;br /&gt;
    JRequest::setVar( &#039;view&#039;, &#039;hello&#039; );&lt;br /&gt;
    JRequest::setVar( &#039;layout&#039;, &#039;form&#039;  );&lt;br /&gt;
    JRequest::setVar( &#039;hidemainmenu&#039;, 1 );&lt;br /&gt;
&lt;br /&gt;
    parent::display();&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE on naming conventions:  The top calling program (hello.php) makes assumptions about the file names and class names of the controllers.  To summarize for this example: &lt;br /&gt;
&lt;br /&gt;
   Default controller path:    …/controller.php&lt;br /&gt;
   Default controller class name:  HelloController&lt;br /&gt;
&lt;br /&gt;
   Requested controller path …/controllers/&amp;lt;requestName&amp;gt;.php&lt;br /&gt;
   Requested controller class name:  HelloController&amp;lt;requestName&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The code for the controller at admin/controllers/hello.php:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Controller for Hello World Component&lt;br /&gt;
 * &lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_4&lt;br /&gt;
 * @license		GNU/GPL&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access&lt;br /&gt;
defined( &#039;_JEXEC&#039; ) or die( &#039;Restricted access&#039; );&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Hello Controller&lt;br /&gt;
 *&lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 */&lt;br /&gt;
class HellosControllerHello extends HellosController&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * constructor (registers additional tasks to methods)&lt;br /&gt;
	 * @return void&lt;br /&gt;
	 */&lt;br /&gt;
	function __construct()&lt;br /&gt;
	{&lt;br /&gt;
		parent::__construct();&lt;br /&gt;
&lt;br /&gt;
		// Register Extra tasks&lt;br /&gt;
		$this-&amp;gt;registerTask( &#039;add&#039;  , 	&#039;edit&#039; );&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * display the edit form&lt;br /&gt;
	 * @return void&lt;br /&gt;
	 */&lt;br /&gt;
	function edit()&lt;br /&gt;
	{&lt;br /&gt;
		JRequest::setVar( &#039;view&#039;, &#039;hello&#039; );&lt;br /&gt;
		JRequest::setVar( &#039;layout&#039;, &#039;form&#039;  );&lt;br /&gt;
		JRequest::setVar(&#039;hidemainmenu&#039;, 1);&lt;br /&gt;
&lt;br /&gt;
		parent::display();&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Hello View ====&lt;br /&gt;
&lt;br /&gt;
The Hello view will display a form which will allow the user to edit a greeting. The display method if the hello view has to do a few simple tasks:&lt;br /&gt;
&lt;br /&gt;
* retrieve the data from the model&lt;br /&gt;
* create the toolbar&lt;br /&gt;
* pass the data into the template&lt;br /&gt;
* invoke the display() method to render the template&lt;br /&gt;
&lt;br /&gt;
This becomes a bit more complicated because the one view handles both the edit and add tasks. In our toolbar we want the user to know whether they are adding or editing, so we have to determine which task was fired.&lt;br /&gt;
&lt;br /&gt;
Since we are already retrieving the record that we want to display from the model, we can use this data to determine what task was fired. If the task was edit, then the id field of our record will have been set. If the task was new, then it will not have been set. This can be used to determine if we have a new record or an existing record.&lt;br /&gt;
&lt;br /&gt;
We will add two buttons to the toolbar: save and cancel. Though the functionality will be the same, we want to display different buttons depending on whether it is a new or existing record. If it is a new record, we will display cancel. If it already exists, we will display close.&lt;br /&gt;
&lt;br /&gt;
Thus our display method looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * display method of Hello view&lt;br /&gt;
 * @return void&lt;br /&gt;
 **/&lt;br /&gt;
function display($tpl = null)&lt;br /&gt;
{&lt;br /&gt;
    //get the hello&lt;br /&gt;
    $hello        =&amp;amp; $this-&amp;gt;get(&#039;Data&#039;);&lt;br /&gt;
    $isNew        = ($hello-&amp;gt;id &amp;lt; 1);&lt;br /&gt;
&lt;br /&gt;
    $text = $isNew ? JText::_( &#039;New&#039; ) : JText::_( &#039;Edit&#039; );&lt;br /&gt;
    JToolBarHelper::title(   JText::_( &#039;Hello&#039; ).&#039;: &amp;lt;small&amp;gt;&amp;lt;small&amp;gt;[ &#039; . $text.&#039; ]&amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt;&#039; );&lt;br /&gt;
    JToolBarHelper::save();&lt;br /&gt;
    if ($isNew)  {&lt;br /&gt;
        JToolBarHelper::cancel();&lt;br /&gt;
    } else {&lt;br /&gt;
        // for existing items the button is renamed `close`&lt;br /&gt;
        JToolBarHelper::cancel( &#039;cancel&#039;, &#039;Close&#039; );&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    $this-&amp;gt;assignRef(&#039;hello&#039;, $hello);&lt;br /&gt;
    parent::display($tpl);&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The code for the view at admin/views/hello/view.html.php:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * Hello View for Hello World Component&lt;br /&gt;
 * &lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_4&lt;br /&gt;
 * @license		GNU/GPL&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access&lt;br /&gt;
defined( &#039;_JEXEC&#039; ) or die( &#039;Restricted access&#039; );&lt;br /&gt;
&lt;br /&gt;
jimport( &#039;joomla.application.component.view&#039; );&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello View&lt;br /&gt;
 *&lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 */&lt;br /&gt;
class HellosViewHello extends JView&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * display method of Hello view&lt;br /&gt;
	 * @return void&lt;br /&gt;
	 **/&lt;br /&gt;
	function display($tpl = null)&lt;br /&gt;
	{&lt;br /&gt;
		//get the hello&lt;br /&gt;
		$hello		=&amp;amp; $this-&amp;gt;get(&#039;Data&#039;);&lt;br /&gt;
		$isNew		= ($hello-&amp;gt;id &amp;lt; 1);&lt;br /&gt;
&lt;br /&gt;
		$text = $isNew ? JText::_( &#039;New&#039; ) : JText::_( &#039;Edit&#039; );&lt;br /&gt;
		JToolBarHelper::title(   JText::_( &#039;Hello&#039; ).&#039;: &amp;lt;small&amp;gt;&amp;lt;small&amp;gt;[ &#039; . $text.&#039; ]&amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt;&#039; );&lt;br /&gt;
		JToolBarHelper::save();&lt;br /&gt;
		if ($isNew)  {&lt;br /&gt;
			JToolBarHelper::cancel();&lt;br /&gt;
		} else {&lt;br /&gt;
			// for existing items the button is renamed `close`&lt;br /&gt;
			JToolBarHelper::cancel( &#039;cancel&#039;, &#039;Close&#039; );&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$this-&amp;gt;assignRef(&#039;hello&#039;,		$hello);&lt;br /&gt;
&lt;br /&gt;
		parent::display($tpl);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Hello Model ====&lt;br /&gt;
&lt;br /&gt;
Our view needs data. Therefore, we need to create a model to model a hello.&lt;br /&gt;
&lt;br /&gt;
Our model will have two properties: _id and _data. _id will hold the id of the greeting and data will hold the data.&lt;br /&gt;
&lt;br /&gt;
We will start with a constructor, which will attempt to retrieve the id from the query:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * Constructor that retrieves the ID from the request&lt;br /&gt;
 *&lt;br /&gt;
 * @access    public&lt;br /&gt;
 * @return    void&lt;br /&gt;
 */&lt;br /&gt;
function __construct()&lt;br /&gt;
{&lt;br /&gt;
    parent::__construct();&lt;br /&gt;
&lt;br /&gt;
    $array = JRequest::getVar(&#039;cid&#039;,  0, &#039;&#039;, &#039;array&#039;);&lt;br /&gt;
    $this-&amp;gt;setId((int)$array[0]);&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The JRequest::getVar() method is used to retrieve data from the request. The first parameter is the name of the form variable. The second parameter is the default value to assign if there is no value found. The third parameter is the name of the hash to retrieve the value from (get, post, etc), and the last value is the data type that should be forced on the value.&lt;br /&gt;
&lt;br /&gt;
Our constructor will take the first value from the cid array and assign it to the id.&lt;br /&gt;
&lt;br /&gt;
Our setId() method can be used to set our id. Changing the id that our model points to will mean the id points to the wrong data. Therefore, when we set the id, we will clear the data property:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * Method to set the hello identifier&lt;br /&gt;
 *&lt;br /&gt;
 * @access    public&lt;br /&gt;
 * @param    int Hello identifier&lt;br /&gt;
 * @return    void&lt;br /&gt;
 */&lt;br /&gt;
function setId($id)&lt;br /&gt;
{&lt;br /&gt;
    // Set id and wipe data&lt;br /&gt;
    $this-&amp;gt;_id        = $id;&lt;br /&gt;
    $this-&amp;gt;_data    = null;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we need a method to retrieve our data: getData()&lt;br /&gt;
&lt;br /&gt;
getData will check if the _data property has already been set. If it has, it will simply return it. Otherwise, it will load the data from the database.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * Method to get a hello&lt;br /&gt;
 * @return object with data&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
function &amp;amp;getData()&lt;br /&gt;
{&lt;br /&gt;
    // Load the data&lt;br /&gt;
    if (empty( $this-&amp;gt;_data )) {&lt;br /&gt;
        $query = &#039; SELECT * FROM #__hello &#039;.&lt;br /&gt;
                &#039;  WHERE id = &#039;.$this-&amp;gt;_id;&lt;br /&gt;
        $this-&amp;gt;_db-&amp;gt;setQuery( $query );&lt;br /&gt;
        $this-&amp;gt;_data = $this-&amp;gt;_db-&amp;gt;loadObject();&lt;br /&gt;
    }&lt;br /&gt;
    if (!$this-&amp;gt;_data) {&lt;br /&gt;
        $this-&amp;gt;_data = new stdClass();&lt;br /&gt;
        $this-&amp;gt;_data-&amp;gt;id = 0;&lt;br /&gt;
        $this-&amp;gt;_data-&amp;gt;greeting = null;&lt;br /&gt;
    }&lt;br /&gt;
    return $this-&amp;gt;_data;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Form ====&lt;br /&gt;
&lt;br /&gt;
Now all that is left is to create the form that the data will go into. Since we specified our layout as form, the form will go in a file in the tmpl directory of the hello view called form.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;); ?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;form action=&amp;quot;index.php&amp;quot; method=&amp;quot;post&amp;quot; name=&amp;quot;adminForm&amp;quot; id=&amp;quot;adminForm&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;col100&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;fieldset class=&amp;quot;adminform&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;legend&amp;gt;&amp;lt;?php echo JText::_( &#039;Details&#039; ); ?&amp;gt;&amp;lt;/legend&amp;gt;&lt;br /&gt;
        &amp;lt;table class=&amp;quot;admintable&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;tr&amp;gt;&lt;br /&gt;
            &amp;lt;td width=&amp;quot;100&amp;quot; align=&amp;quot;right&amp;quot; class=&amp;quot;key&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;label for=&amp;quot;greeting&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;?php echo JText::_( &#039;Greeting&#039; ); ?&amp;gt;:&lt;br /&gt;
                &amp;lt;/label&amp;gt;&lt;br /&gt;
            &amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;&lt;br /&gt;
                &amp;lt;input class=&amp;quot;text_area&amp;quot; type=&amp;quot;text&amp;quot; name=&amp;quot;greeting&amp;quot; id=&amp;quot;greeting&amp;quot; size=&amp;quot;32&amp;quot; maxlength=&amp;quot;250&amp;quot; value=&amp;quot;&amp;lt;?php echo $this-&amp;gt;hello-&amp;gt;greeting;?&amp;gt;&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;/table&amp;gt;&lt;br /&gt;
    &amp;lt;/fieldset&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;clr&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;option&amp;quot; value=&amp;quot;com_hello&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;id&amp;quot; value=&amp;quot;&amp;lt;?php echo $this-&amp;gt;hello-&amp;gt;id; ?&amp;gt;&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;task&amp;quot; value=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;controller&amp;quot; value=&amp;quot;hello&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that in addition to the input field, there is a hidden field for the id. The user doesn&#039;t need to edit the id (and shouldn&#039;t), so we silently pass it along in the form.&lt;br /&gt;
&lt;br /&gt;
==== Implementing the Functionality ====&lt;br /&gt;
&lt;br /&gt;
So far, our controller only handles two tasks: edit and new. However, we also have buttons to save, delete and cancel records. We need to write code to handle and perform these tasks.&lt;br /&gt;
&lt;br /&gt;
=== Saving a Record ===&lt;br /&gt;
&lt;br /&gt;
The logical next step is to implement the functionality to save a record. Normally, this would require some switches and logic to handle various cases, such as the difference between creating a new record (an INSERT query), and updating an existing query (an UPDATE query). Also, there are complexities involved in getting the data from the form and putting it into the query.&lt;br /&gt;
&lt;br /&gt;
The Joomla! framework takes care of a lot of this for you. The JTable class makes it easy to manipulate records in the database without having to worry about writing the SQL code that lies behind these updates. It also makes it easy to transfer data from an HTML form into the database.&lt;br /&gt;
&lt;br /&gt;
== Creating the Table Class ==&lt;br /&gt;
&lt;br /&gt;
The JTable class is an abstract class from which you can derive child classes to work with specific tables. To use it, you simply create a class that extends the JTable class, add your database fields as properties, and override the constructor to specify the name of the table and the primary key.&lt;br /&gt;
&lt;br /&gt;
Here is our JTable class:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * Hello World table class&lt;br /&gt;
 * &lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_4&lt;br /&gt;
 * @license        GNU/GPL&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Table class&lt;br /&gt;
 *&lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 */&lt;br /&gt;
class TableHello extends JTable&lt;br /&gt;
{&lt;br /&gt;
    /**&lt;br /&gt;
     * Primary Key&lt;br /&gt;
     *&lt;br /&gt;
     * @var int&lt;br /&gt;
     */&lt;br /&gt;
    var $id = null;&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * @var string&lt;br /&gt;
     */&lt;br /&gt;
    var $greeting = null;&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Constructor&lt;br /&gt;
     *&lt;br /&gt;
     * @param object Database connector object&lt;br /&gt;
     */&lt;br /&gt;
    function __construct( &amp;amp;$db ) {&lt;br /&gt;
        parent::__construct(&#039;#__hello&#039;, &#039;id&#039;, $db);&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see here that we have defined our two fields: the id field and the greeting field. Then we have defined a constructor, which will call the constructor of the parent class and pass it the name of the table (hello), the name of the field which is the primary key (id), and the database connector object.&lt;br /&gt;
&lt;br /&gt;
This file should be called hello.php and it will go in a directory called tables in the administrator section of our component.&lt;br /&gt;
&lt;br /&gt;
== Implementing the Function in our Model ==&lt;br /&gt;
&lt;br /&gt;
We are now ready to add the method to the model which will save our record. We will call this method store. Our store() method will do three things: bind the data from the form to the TableHello object, check to ensure that the record is properly formed, and store the record in the database.&lt;br /&gt;
&lt;br /&gt;
Our method looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * Method to store a record&lt;br /&gt;
 *&lt;br /&gt;
 * @access    public&lt;br /&gt;
 * @return    boolean    True on success&lt;br /&gt;
 */&lt;br /&gt;
function store()&lt;br /&gt;
{&lt;br /&gt;
    $row =&amp;amp; $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
    $data = JRequest::get( &#039;post&#039; );&lt;br /&gt;
    // Bind the form fields to the hello table&lt;br /&gt;
    if (!$row-&amp;gt;bind($data)) {&lt;br /&gt;
        $this-&amp;gt;setError($this-&amp;gt;_db-&amp;gt;getErrorMsg());&lt;br /&gt;
        return false;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Make sure the hello record is valid&lt;br /&gt;
    if (!$row-&amp;gt;check()) {&lt;br /&gt;
        $this-&amp;gt;setError($this-&amp;gt;_db-&amp;gt;getErrorMsg());&lt;br /&gt;
        return false;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Store the web link table to the database&lt;br /&gt;
    if (!$row-&amp;gt;store()) {&lt;br /&gt;
        $this-&amp;gt;setError($this-&amp;gt;_db-&amp;gt;getErrorMsg());&lt;br /&gt;
        return false;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return true;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method gets added to the hello model.&lt;br /&gt;
&lt;br /&gt;
The method takes one parameter, which is an associative array of data that we want to store in the database. This can easily be retrieved from the request as will be seen later.&lt;br /&gt;
&lt;br /&gt;
You will see that the first line retrieves a reference to our JTable object. If we name our table properly, we don&#039;t have to specify its name - the JModel class knows where to find it. You may recall that we called our table class TableHello and put it in a file called hello.php in the tables directory. If you follow this convention, the JModel class can create your object automatically.&lt;br /&gt;
&lt;br /&gt;
The second line will retrieve the data from the form. The JRequest class makes this very easy. In this case, we are retrieving all of the variables that were submitted using the &#039;POST&#039; method. These will be returned as an associative array.&lt;br /&gt;
&lt;br /&gt;
The rest is easy - we bind, check and store. The [http://docs.joomla.org/API15:JTable/bind bind()] method will copy values from the array into the corresponding property of the table object. In this case, it will take the values of id and greeting and copy them to our TableHello object.&lt;br /&gt;
&lt;br /&gt;
The [http://docs.joomla.org/API15:JTable/check check()] method will perform data verification. In the JTable() class, this method simply returns true. While this doesn&#039;t provide any value for us currently, by calling this method we make it possible to do data checking using our TableHello class in the future. This method can be overridden in our TableHello class with a method that performs the appropriate checks.&lt;br /&gt;
&lt;br /&gt;
The [http://docs.joomla.org/API15:JTable/store store()] method will take the data that is in the object and store it in the database. If the id is 0, it will create a new record (INSERT), otherwise, it will update the existing record (UPDATE).&lt;br /&gt;
&lt;br /&gt;
== Adding the Task to the Controller ==&lt;br /&gt;
&lt;br /&gt;
We are now ready to add our task to the controller. Since the task that we are firing is called &#039;save&#039;, we must call our method &#039;save&#039;. This is simple:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * save a record (and redirect to main page)&lt;br /&gt;
 * @return void&lt;br /&gt;
 */&lt;br /&gt;
function save()&lt;br /&gt;
{&lt;br /&gt;
    $model = $this-&amp;gt;getModel(&#039;hello&#039;);&lt;br /&gt;
&lt;br /&gt;
    if ($model-&amp;gt;store()) {&lt;br /&gt;
        $msg = JText::_( &#039;Greeting Saved!&#039; );&lt;br /&gt;
    } else {&lt;br /&gt;
        $msg = JText::_( &#039;Error Saving Greeting&#039; );&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Check the table in so it can be edited.... we are done with it anyway&lt;br /&gt;
    $link = &#039;index.php?option=com_hello&#039;;&lt;br /&gt;
    $this-&amp;gt;setRedirect($link, $msg);&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All we do is get our model and invoke the store() method. Then we use the setRedirect() method to redirect back to our list of greetings. We also pass a message along, which will be displayed at the top of the page.&lt;br /&gt;
&lt;br /&gt;
=== Deleting a Record ===&lt;br /&gt;
&lt;br /&gt;
=== Implementing the Function in the Model ===&lt;br /&gt;
&lt;br /&gt;
In the model, we will retrieve the list of IDs to delete and call the JTable class to delete them. Here it is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * Method to delete record(s)&lt;br /&gt;
 *&lt;br /&gt;
 * @access    public&lt;br /&gt;
 * @return    boolean    True on success&lt;br /&gt;
 */&lt;br /&gt;
function delete()&lt;br /&gt;
{&lt;br /&gt;
    $cids = JRequest::getVar( &#039;cid&#039;, array(0), &#039;post&#039;, &#039;array&#039; );&lt;br /&gt;
    $row =&amp;amp; $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
    foreach($cids as $cid) {&lt;br /&gt;
        if (!$row-&amp;gt;delete( $cid )) {&lt;br /&gt;
            $this-&amp;gt;setError( $row-&amp;gt;getErrorMsg() );&lt;br /&gt;
            return false;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return true;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We invoke the JRequest::getVar() method to get the data from the request, then we invoke the $row-&amp;gt;delete() method to delete each row. By storing errors in the model we make it possible to retrieve them later if we so choose.&lt;br /&gt;
&lt;br /&gt;
=== Handling the Remove Task in the Controller ===&lt;br /&gt;
&lt;br /&gt;
This is similar to the save() method which handled the save task:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * remove record(s)&lt;br /&gt;
 * @return void&lt;br /&gt;
 */&lt;br /&gt;
function remove()&lt;br /&gt;
{&lt;br /&gt;
    $model = $this-&amp;gt;getModel(&#039;hello&#039;);&lt;br /&gt;
    if(!$model-&amp;gt;delete()) {&lt;br /&gt;
        $msg = JText::_( &#039;Error: One or More Greetings Could not be Deleted&#039; );&lt;br /&gt;
    } else {&lt;br /&gt;
        $msg = JText::_( &#039;Greeting(s) Deleted&#039; );&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    $this-&amp;gt;setRedirect( &#039;index.php?option=com_hello&#039;, $msg );&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Cancelling the Edit Operation ====&lt;br /&gt;
&lt;br /&gt;
To cancel the edit operation, all we have to do is redirect back to the main view:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * cancel editing a record&lt;br /&gt;
 * @return void&lt;br /&gt;
 */&lt;br /&gt;
function cancel()&lt;br /&gt;
{&lt;br /&gt;
    $msg = JText::_( &#039;Operation Cancelled&#039; );&lt;br /&gt;
    $this-&amp;gt;setRedirect( &#039;index.php?option=com_hello&#039;, $msg );&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
We have now implemented a basic backend to our component. We are now able to edit the entries that are viewed in the frontend. We have demonstrated the interaction between models, views and controllers. We have shown how the JTable class can be extended to provide easy access to tables in the database. It can also be seen how the JToolBarHelper class can be used to create button bars in components to present a standardized look between components.&lt;br /&gt;
&lt;br /&gt;
== Articles in this Series ==&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 1]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 2 - Adding a Model]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 3 - Using the Database]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 4 - Creating an Administrator Interface]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 5 - Basic Backend Framework]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 6 - Adding Backend Actions]]&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
* staalanden&lt;br /&gt;
* jamesconroyuk&lt;br /&gt;
&lt;br /&gt;
== Download ==&lt;br /&gt;
&lt;br /&gt;
The component can be downloaded at: [http://joomlacode.org/gf/download/frsrelease/8111/29436/com_hello4_01.zip com_hello4_01]&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Kissaki</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J1.5:Developing_a_MVC_Component/Adding_Backend_Actions&amp;diff=30639</id>
		<title>J1.5:Developing a MVC Component/Adding Backend Actions</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J1.5:Developing_a_MVC_Component/Adding_Backend_Actions&amp;diff=30639"/>
		<updated>2010-09-12T15:24:16Z</updated>

		<summary type="html">&lt;p&gt;Kissaki: /* The Hello Controller */ csty&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This article focuses on adding functionality to the current &#039;&#039;dumb&#039;&#039; page/article for the administrator. For an administrator the current default view is pretty useless. It doesn&#039;t really do anything - all it does is display the entries that we have in our database.&lt;br /&gt;
&lt;br /&gt;
In order to make it useful, we need to add some buttons and links. This article extends the component with content management tasks. Add, Change and Delete are the typical tasks that will be added.&lt;br /&gt;
&lt;br /&gt;
==Adding interaction ==&lt;br /&gt;
Interaction will be added on two levels. Within the administrator framework by means of Toolbar extension and within the article itself by means of reference links and form postings. For basic understanding see [[Developing a Model-View-Controller Component - Part 4 - Creating an Administrator Interface]].&lt;br /&gt;
&lt;br /&gt;
=== The Toolbar ===&lt;br /&gt;
&lt;br /&gt;
You may have noticed the toolbar that appears at the top of other Joomla! component administrator panels. Our component needs one as well. Joomla! makes this very easy to do. We will add buttons Delete records, Edit records, and create New records. We will also add a title that will be displayed on our toolbar.&lt;br /&gt;
&lt;br /&gt;
This is done by adding code to the view. To add the buttons, we use static methods from the Joomla! JToolBarHelper class. The code looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;JToolBarHelper::title(   JText::_( &#039;Hello Manager&#039; ), &#039;generic.png&#039; );&lt;br /&gt;
JToolBarHelper::deleteList();&lt;br /&gt;
JToolBarHelper::editListX();&lt;br /&gt;
JToolBarHelper::addNewX();&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These three methods will create the appropriate buttons. The deleteList() method can optionally take up to three parameters - the first parameter is a string to display to the user to confirm that they want to delete the records. The second is the task that should be sent with the query (the default is &#039;remove&#039;), and the third is the text that should be displayed below the button.&lt;br /&gt;
&lt;br /&gt;
The editListX() and addNewX() methods can each take two optional parameters. The first is the task (which are by default edit and add, respectively), and the second is the text that should be displayed below the button.&lt;br /&gt;
&lt;br /&gt;
*You may have noticed the use of the JText::_ method in the template before and here as well. This is a handy function that makes component translation much easier. The JText::_ method will look up the string in your component language file and return the translated string. If no translation text is found, it will return the string that you passed to it. If you want to translate your component into another language, all you have to do is create a language file that will map the strings within the quotes to the translated version of the string.&lt;br /&gt;
&lt;br /&gt;
=== Checkboxes and Links ===&lt;br /&gt;
&lt;br /&gt;
We now have buttons. Two of those buttons operate on existing records. But how do we know which records to operate on? We have to let the user tell us. To do this, we need to add checkboxes to our table so that the user can select certain records. This is done in our template.&lt;br /&gt;
&lt;br /&gt;
In order to the add the checkboxes, we need to add an extra column into our table. We will add the column in between the two that we already have.&lt;br /&gt;
&lt;br /&gt;
In the header of the column, we will add a checkbox which can be used to toggle all the boxes below it on or off:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;th width=&amp;quot;20&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input type=&amp;quot;checkbox&amp;quot; name=&amp;quot;toggle&amp;quot; value=&amp;quot;&amp;quot; onclick=&amp;quot;checkAll(&amp;lt;?php echo count( $this-&amp;gt;items ); ?&amp;gt;);&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/th&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Javascript checkAll function is a function that is built into the Joomla! base Javascript package that provides the functionality that we want here.&lt;br /&gt;
&lt;br /&gt;
Now we need to add the checkboxes into the individual rows. Joomla!&#039;s JHTML class has a method, JHTML::_(), which will generate our checkbox for us. We will add the following line to our loop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;$checked    = JHTML::_( &#039;grid.id&#039;, $i, $row-&amp;gt;id );&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
after the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;$row =&amp;amp; $this-&amp;gt;items[$i];&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we will add a cell in between the two that we already have:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
    &amp;lt;?php echo $checked; ?&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be cumbersome to have to check the box that we want to edit and then move up and click the edit button. Therefore, we will add a link so that it will go straight to the greeting&#039;s edit form. We will add the following line after the call to the JHTML::_() method to generate the link HTML:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;$link = JRoute::_( &#039;index.php?option=com_hello&amp;amp;controller=hello&amp;amp;task=edit&amp;amp;cid[]=&#039;. $row-&amp;gt;id );&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And we include the link in the cell showing the greeting text:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
    &amp;lt;a href=&amp;quot;&amp;lt;?php echo $link; ?&amp;gt;&amp;quot;&amp;gt;&amp;lt;?php echo $row-&amp;gt;greeting; ?&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that this link points to the hello controller. This controller will handle the data manipulation of our greetings.&lt;br /&gt;
&lt;br /&gt;
If you recall from above, we had four hidden input fields at the bottom of our form. The first input field was named &#039;option&#039;. This field is necessary so that we stay in our component. The second input field was task. This form property gets set when one of the buttons in the toolbar is clicked. A Javascript error will result and the buttons will not work if this input field is omitted. The third input field is the boxchecked field. This field keeps track of the number of boxes that are checked. The edit and delete buttons will check to ensure that this is greater than zero and will not allow the form to be submitted if it is not. The fourth input field is the controller field. This is used to specify that tasks fired from this form will be handled by the hello controller.&lt;br /&gt;
&lt;br /&gt;
Here is the code for the completed default.php file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;); ?&amp;gt;&lt;br /&gt;
&amp;lt;form action=&amp;quot;index.php&amp;quot; method=&amp;quot;post&amp;quot; name=&amp;quot;adminForm&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;editcell&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;table class=&amp;quot;adminlist&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;thead&amp;gt;&lt;br /&gt;
        &amp;lt;tr&amp;gt;&lt;br /&gt;
            &amp;lt;th width=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;?php echo JText::_( &#039;ID&#039; ); ?&amp;gt;&lt;br /&gt;
            &amp;lt;/th&amp;gt;&lt;br /&gt;
            &amp;lt;th width=&amp;quot;20&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;input type=&amp;quot;checkbox&amp;quot; name=&amp;quot;toggle&amp;quot; value=&amp;quot;&amp;quot; onclick=&amp;quot;checkAll(&amp;lt;?php echo count( $this-&amp;gt;items ); ?&amp;gt;);&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;/th&amp;gt;&lt;br /&gt;
            &amp;lt;th&amp;gt;&lt;br /&gt;
                &amp;lt;?php echo JText::_( &#039;Greeting&#039; ); ?&amp;gt;&lt;br /&gt;
            &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;            &lt;br /&gt;
    &amp;lt;/thead&amp;gt;&lt;br /&gt;
    &amp;lt;?php&lt;br /&gt;
    $k = 0;&lt;br /&gt;
    for ($i=0, $n=count( $this-&amp;gt;items ); $i &amp;lt; $n; $i++)&lt;br /&gt;
    {&lt;br /&gt;
        $row =&amp;amp; $this-&amp;gt;items[$i];&lt;br /&gt;
        $checked    = JHTML::_( &#039;grid.id&#039;, $i, $row-&amp;gt;id );&lt;br /&gt;
        $link = JRoute::_( &#039;index.php?option=com_hello&amp;amp;controller=hello&amp;amp;task=edit&amp;amp;cid[]=&#039;. $row-&amp;gt;id );&lt;br /&gt;
        &lt;br /&gt;
        ?&amp;gt;&lt;br /&gt;
        &amp;lt;tr class=&amp;quot;&amp;lt;?php echo &amp;quot;row$k&amp;quot;; ?&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;&lt;br /&gt;
                &amp;lt;?php echo $row-&amp;gt;id; ?&amp;gt;&lt;br /&gt;
            &amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;&lt;br /&gt;
              &amp;lt;?php echo $checked; ?&amp;gt;&lt;br /&gt;
            &amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;&lt;br /&gt;
                &amp;lt;a href=&amp;quot;&amp;lt;?php echo $link; ?&amp;gt;&amp;quot;&amp;gt;&amp;lt;?php echo $row-&amp;gt;greeting; ?&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
            &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;?php&lt;br /&gt;
        $k = 1 - $k;&lt;br /&gt;
    }&lt;br /&gt;
    ?&amp;gt;&lt;br /&gt;
    &amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;option&amp;quot; value=&amp;quot;com_hello&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;task&amp;quot; value=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;boxchecked&amp;quot; value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;controller&amp;quot; value=&amp;quot;hello&amp;quot; /&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/form&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Our hellos view is now complete.&lt;br /&gt;
&lt;br /&gt;
== Getting Down and Dirty: Doing the Real Work ==&lt;br /&gt;
&lt;br /&gt;
Now that the Hellos view is done, it is time to move to the Hello controller and model. This is where the real work will get done.&lt;br /&gt;
&lt;br /&gt;
==== The Hello Controller ====&lt;br /&gt;
&lt;br /&gt;
Our default controller just isn&#039;t going to cut it when it comes to doing work - all it is capable of doing is displaying views.&lt;br /&gt;
&lt;br /&gt;
We need to be able to handle the tasks that we are launching from the Hellos view: add, edit and remove. The singular named Hello controller is created (and located in the controllers sub-directory) to actually add, edit and remove the individual entries.&lt;br /&gt;
&lt;br /&gt;
Add and edit are essentially the same task: they both display a form to the user that allows a greeting to be edited. The only difference is that new displays a blank form, and edit displays a form with data already in it. Since they are similar, we will map the add task onto the edit task handler. This is specified in our constructor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * constructor (registers additional tasks to methods)&lt;br /&gt;
 * @return void&lt;br /&gt;
 */&lt;br /&gt;
function __construct()&lt;br /&gt;
{&lt;br /&gt;
    parent::__construct();&lt;br /&gt;
&lt;br /&gt;
    // Register Extra tasks&lt;br /&gt;
    $this-&amp;gt;registerTask( &#039;add&#039;, &#039;edit&#039; );&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first parameter of JController::registerTask is the task to map, and the second is the method to map it to.&lt;br /&gt;
&lt;br /&gt;
We will start with handling the edit task. The controller&#039;s job is fairly simple for the edit task. All it has to do is specify the view and layout to load (the hello view and the form layout). We will also tell Joomla! to disable the mainmenu while we are editing our greeting. This prevents users from leaving unsaved records open.&lt;br /&gt;
&lt;br /&gt;
Our edit task handler looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * display the edit form&lt;br /&gt;
 * @return void&lt;br /&gt;
 */&lt;br /&gt;
function edit()&lt;br /&gt;
{&lt;br /&gt;
    JRequest::setVar( &#039;view&#039;, &#039;hello&#039; );&lt;br /&gt;
    JRequest::setVar( &#039;layout&#039;, &#039;form&#039;  );&lt;br /&gt;
    JRequest::setVar(&#039;hidemainmenu&#039;, 1);&lt;br /&gt;
&lt;br /&gt;
    parent::display();&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE on naming conventions:  The top calling program (hello.php) makes assumptions about the file names and class names of the controllers.  To summarize for this example: &lt;br /&gt;
&lt;br /&gt;
   Default controller path:    …/controller.php&lt;br /&gt;
   Default controller class name:  HelloController&lt;br /&gt;
&lt;br /&gt;
   Requested controller path …/controllers/&amp;lt;requestName&amp;gt;.php&lt;br /&gt;
   Requested controller class name:  HelloController&amp;lt;requestName&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The code for the controller at admin/controllers/hello.php:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Controller for Hello World Component&lt;br /&gt;
 * &lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_4&lt;br /&gt;
 * @license		GNU/GPL&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access&lt;br /&gt;
defined( &#039;_JEXEC&#039; ) or die( &#039;Restricted access&#039; );&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Hello Controller&lt;br /&gt;
 *&lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 */&lt;br /&gt;
class HellosControllerHello extends HellosController&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * constructor (registers additional tasks to methods)&lt;br /&gt;
	 * @return void&lt;br /&gt;
	 */&lt;br /&gt;
	function __construct()&lt;br /&gt;
	{&lt;br /&gt;
		parent::__construct();&lt;br /&gt;
&lt;br /&gt;
		// Register Extra tasks&lt;br /&gt;
		$this-&amp;gt;registerTask( &#039;add&#039;  , 	&#039;edit&#039; );&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * display the edit form&lt;br /&gt;
	 * @return void&lt;br /&gt;
	 */&lt;br /&gt;
	function edit()&lt;br /&gt;
	{&lt;br /&gt;
		JRequest::setVar( &#039;view&#039;, &#039;hello&#039; );&lt;br /&gt;
		JRequest::setVar( &#039;layout&#039;, &#039;form&#039;  );&lt;br /&gt;
		JRequest::setVar(&#039;hidemainmenu&#039;, 1);&lt;br /&gt;
&lt;br /&gt;
		parent::display();&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Hello View ====&lt;br /&gt;
&lt;br /&gt;
The Hello view will display a form which will allow the user to edit a greeting. The display method if the hello view has to do a few simple tasks:&lt;br /&gt;
&lt;br /&gt;
* retrieve the data from the model&lt;br /&gt;
* create the toolbar&lt;br /&gt;
* pass the data into the template&lt;br /&gt;
* invoke the display() method to render the template&lt;br /&gt;
&lt;br /&gt;
This becomes a bit more complicated because the one view handles both the edit and add tasks. In our toolbar we want the user to know whether they are adding or editing, so we have to determine which task was fired.&lt;br /&gt;
&lt;br /&gt;
Since we are already retrieving the record that we want to display from the model, we can use this data to determine what task was fired. If the task was edit, then the id field of our record will have been set. If the task was new, then it will not have been set. This can be used to determine if we have a new record or an existing record.&lt;br /&gt;
&lt;br /&gt;
We will add two buttons to the toolbar: save and cancel. Though the functionality will be the same, we want to display different buttons depending on whether it is a new or existing record. If it is a new record, we will display cancel. If it already exists, we will display close.&lt;br /&gt;
&lt;br /&gt;
Thus our display method looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * display method of Hello view&lt;br /&gt;
 * @return void&lt;br /&gt;
 **/&lt;br /&gt;
function display($tpl = null)&lt;br /&gt;
{&lt;br /&gt;
    //get the hello&lt;br /&gt;
    $hello        =&amp;amp; $this-&amp;gt;get(&#039;Data&#039;);&lt;br /&gt;
    $isNew        = ($hello-&amp;gt;id &amp;lt; 1);&lt;br /&gt;
&lt;br /&gt;
    $text = $isNew ? JText::_( &#039;New&#039; ) : JText::_( &#039;Edit&#039; );&lt;br /&gt;
    JToolBarHelper::title(   JText::_( &#039;Hello&#039; ).&#039;: &amp;lt;small&amp;gt;&amp;lt;small&amp;gt;[ &#039; . $text.&#039; ]&amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt;&#039; );&lt;br /&gt;
    JToolBarHelper::save();&lt;br /&gt;
    if ($isNew)  {&lt;br /&gt;
        JToolBarHelper::cancel();&lt;br /&gt;
    } else {&lt;br /&gt;
        // for existing items the button is renamed `close`&lt;br /&gt;
        JToolBarHelper::cancel( &#039;cancel&#039;, &#039;Close&#039; );&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    $this-&amp;gt;assignRef(&#039;hello&#039;, $hello);&lt;br /&gt;
    parent::display($tpl);&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The code for the view at admin/views/hello/view.html.php:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * Hello View for Hello World Component&lt;br /&gt;
 * &lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_4&lt;br /&gt;
 * @license		GNU/GPL&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access&lt;br /&gt;
defined( &#039;_JEXEC&#039; ) or die( &#039;Restricted access&#039; );&lt;br /&gt;
&lt;br /&gt;
jimport( &#039;joomla.application.component.view&#039; );&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello View&lt;br /&gt;
 *&lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 */&lt;br /&gt;
class HellosViewHello extends JView&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * display method of Hello view&lt;br /&gt;
	 * @return void&lt;br /&gt;
	 **/&lt;br /&gt;
	function display($tpl = null)&lt;br /&gt;
	{&lt;br /&gt;
		//get the hello&lt;br /&gt;
		$hello		=&amp;amp; $this-&amp;gt;get(&#039;Data&#039;);&lt;br /&gt;
		$isNew		= ($hello-&amp;gt;id &amp;lt; 1);&lt;br /&gt;
&lt;br /&gt;
		$text = $isNew ? JText::_( &#039;New&#039; ) : JText::_( &#039;Edit&#039; );&lt;br /&gt;
		JToolBarHelper::title(   JText::_( &#039;Hello&#039; ).&#039;: &amp;lt;small&amp;gt;&amp;lt;small&amp;gt;[ &#039; . $text.&#039; ]&amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt;&#039; );&lt;br /&gt;
		JToolBarHelper::save();&lt;br /&gt;
		if ($isNew)  {&lt;br /&gt;
			JToolBarHelper::cancel();&lt;br /&gt;
		} else {&lt;br /&gt;
			// for existing items the button is renamed `close`&lt;br /&gt;
			JToolBarHelper::cancel( &#039;cancel&#039;, &#039;Close&#039; );&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$this-&amp;gt;assignRef(&#039;hello&#039;,		$hello);&lt;br /&gt;
&lt;br /&gt;
		parent::display($tpl);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Hello Model ====&lt;br /&gt;
&lt;br /&gt;
Our view needs data. Therefore, we need to create a model to model a hello.&lt;br /&gt;
&lt;br /&gt;
Our model will have two properties: _id and _data. _id will hold the id of the greeting and data will hold the data.&lt;br /&gt;
&lt;br /&gt;
We will start with a constructor, which will attempt to retrieve the id from the query:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * Constructor that retrieves the ID from the request&lt;br /&gt;
 *&lt;br /&gt;
 * @access    public&lt;br /&gt;
 * @return    void&lt;br /&gt;
 */&lt;br /&gt;
function __construct()&lt;br /&gt;
{&lt;br /&gt;
    parent::__construct();&lt;br /&gt;
&lt;br /&gt;
    $array = JRequest::getVar(&#039;cid&#039;,  0, &#039;&#039;, &#039;array&#039;);&lt;br /&gt;
    $this-&amp;gt;setId((int)$array[0]);&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The JRequest::getVar() method is used to retrieve data from the request. The first parameter is the name of the form variable. The second parameter is the default value to assign if there is no value found. The third parameter is the name of the hash to retrieve the value from (get, post, etc), and the last value is the data type that should be forced on the value.&lt;br /&gt;
&lt;br /&gt;
Our constructor will take the first value from the cid array and assign it to the id.&lt;br /&gt;
&lt;br /&gt;
Our setId() method can be used to set our id. Changing the id that our model points to will mean the id points to the wrong data. Therefore, when we set the id, we will clear the data property:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * Method to set the hello identifier&lt;br /&gt;
 *&lt;br /&gt;
 * @access    public&lt;br /&gt;
 * @param    int Hello identifier&lt;br /&gt;
 * @return    void&lt;br /&gt;
 */&lt;br /&gt;
function setId($id)&lt;br /&gt;
{&lt;br /&gt;
    // Set id and wipe data&lt;br /&gt;
    $this-&amp;gt;_id        = $id;&lt;br /&gt;
    $this-&amp;gt;_data    = null;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we need a method to retrieve our data: getData()&lt;br /&gt;
&lt;br /&gt;
getData will check if the _data property has already been set. If it has, it will simply return it. Otherwise, it will load the data from the database.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * Method to get a hello&lt;br /&gt;
 * @return object with data&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
function &amp;amp;getData()&lt;br /&gt;
{&lt;br /&gt;
    // Load the data&lt;br /&gt;
    if (empty( $this-&amp;gt;_data )) {&lt;br /&gt;
        $query = &#039; SELECT * FROM #__hello &#039;.&lt;br /&gt;
                &#039;  WHERE id = &#039;.$this-&amp;gt;_id;&lt;br /&gt;
        $this-&amp;gt;_db-&amp;gt;setQuery( $query );&lt;br /&gt;
        $this-&amp;gt;_data = $this-&amp;gt;_db-&amp;gt;loadObject();&lt;br /&gt;
    }&lt;br /&gt;
    if (!$this-&amp;gt;_data) {&lt;br /&gt;
        $this-&amp;gt;_data = new stdClass();&lt;br /&gt;
        $this-&amp;gt;_data-&amp;gt;id = 0;&lt;br /&gt;
        $this-&amp;gt;_data-&amp;gt;greeting = null;&lt;br /&gt;
    }&lt;br /&gt;
    return $this-&amp;gt;_data;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Form ====&lt;br /&gt;
&lt;br /&gt;
Now all that is left is to create the form that the data will go into. Since we specified our layout as form, the form will go in a file in the tmpl directory of the hello view called form.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;); ?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;form action=&amp;quot;index.php&amp;quot; method=&amp;quot;post&amp;quot; name=&amp;quot;adminForm&amp;quot; id=&amp;quot;adminForm&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;col100&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;fieldset class=&amp;quot;adminform&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;legend&amp;gt;&amp;lt;?php echo JText::_( &#039;Details&#039; ); ?&amp;gt;&amp;lt;/legend&amp;gt;&lt;br /&gt;
        &amp;lt;table class=&amp;quot;admintable&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;tr&amp;gt;&lt;br /&gt;
            &amp;lt;td width=&amp;quot;100&amp;quot; align=&amp;quot;right&amp;quot; class=&amp;quot;key&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;label for=&amp;quot;greeting&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;?php echo JText::_( &#039;Greeting&#039; ); ?&amp;gt;:&lt;br /&gt;
                &amp;lt;/label&amp;gt;&lt;br /&gt;
            &amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;&lt;br /&gt;
                &amp;lt;input class=&amp;quot;text_area&amp;quot; type=&amp;quot;text&amp;quot; name=&amp;quot;greeting&amp;quot; id=&amp;quot;greeting&amp;quot; size=&amp;quot;32&amp;quot; maxlength=&amp;quot;250&amp;quot; value=&amp;quot;&amp;lt;?php echo $this-&amp;gt;hello-&amp;gt;greeting;?&amp;gt;&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;/table&amp;gt;&lt;br /&gt;
    &amp;lt;/fieldset&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;clr&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;option&amp;quot; value=&amp;quot;com_hello&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;id&amp;quot; value=&amp;quot;&amp;lt;?php echo $this-&amp;gt;hello-&amp;gt;id; ?&amp;gt;&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;task&amp;quot; value=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;controller&amp;quot; value=&amp;quot;hello&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that in addition to the input field, there is a hidden field for the id. The user doesn&#039;t need to edit the id (and shouldn&#039;t), so we silently pass it along in the form.&lt;br /&gt;
&lt;br /&gt;
==== Implementing the Functionality ====&lt;br /&gt;
&lt;br /&gt;
So far, our controller only handles two tasks: edit and new. However, we also have buttons to save, delete and cancel records. We need to write code to handle and perform these tasks.&lt;br /&gt;
&lt;br /&gt;
=== Saving a Record ===&lt;br /&gt;
&lt;br /&gt;
The logical next step is to implement the functionality to save a record. Normally, this would require some switches and logic to handle various cases, such as the difference between creating a new record (an INSERT query), and updating an existing query (an UPDATE query). Also, there are complexities involved in getting the data from the form and putting it into the query.&lt;br /&gt;
&lt;br /&gt;
The Joomla! framework takes care of a lot of this for you. The JTable class makes it easy to manipulate records in the database without having to worry about writing the SQL code that lies behind these updates. It also makes it easy to transfer data from an HTML form into the database.&lt;br /&gt;
&lt;br /&gt;
== Creating the Table Class ==&lt;br /&gt;
&lt;br /&gt;
The JTable class is an abstract class from which you can derive child classes to work with specific tables. To use it, you simply create a class that extends the JTable class, add your database fields as properties, and override the constructor to specify the name of the table and the primary key.&lt;br /&gt;
&lt;br /&gt;
Here is our JTable class:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * Hello World table class&lt;br /&gt;
 * &lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_4&lt;br /&gt;
 * @license        GNU/GPL&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Table class&lt;br /&gt;
 *&lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 */&lt;br /&gt;
class TableHello extends JTable&lt;br /&gt;
{&lt;br /&gt;
    /**&lt;br /&gt;
     * Primary Key&lt;br /&gt;
     *&lt;br /&gt;
     * @var int&lt;br /&gt;
     */&lt;br /&gt;
    var $id = null;&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * @var string&lt;br /&gt;
     */&lt;br /&gt;
    var $greeting = null;&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Constructor&lt;br /&gt;
     *&lt;br /&gt;
     * @param object Database connector object&lt;br /&gt;
     */&lt;br /&gt;
    function __construct( &amp;amp;$db ) {&lt;br /&gt;
        parent::__construct(&#039;#__hello&#039;, &#039;id&#039;, $db);&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see here that we have defined our two fields: the id field and the greeting field. Then we have defined a constructor, which will call the constructor of the parent class and pass it the name of the table (hello), the name of the field which is the primary key (id), and the database connector object.&lt;br /&gt;
&lt;br /&gt;
This file should be called hello.php and it will go in a directory called tables in the administrator section of our component.&lt;br /&gt;
&lt;br /&gt;
== Implementing the Function in our Model ==&lt;br /&gt;
&lt;br /&gt;
We are now ready to add the method to the model which will save our record. We will call this method store. Our store() method will do three things: bind the data from the form to the TableHello object, check to ensure that the record is properly formed, and store the record in the database.&lt;br /&gt;
&lt;br /&gt;
Our method looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * Method to store a record&lt;br /&gt;
 *&lt;br /&gt;
 * @access    public&lt;br /&gt;
 * @return    boolean    True on success&lt;br /&gt;
 */&lt;br /&gt;
function store()&lt;br /&gt;
{&lt;br /&gt;
    $row =&amp;amp; $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
    $data = JRequest::get( &#039;post&#039; );&lt;br /&gt;
    // Bind the form fields to the hello table&lt;br /&gt;
    if (!$row-&amp;gt;bind($data)) {&lt;br /&gt;
        $this-&amp;gt;setError($this-&amp;gt;_db-&amp;gt;getErrorMsg());&lt;br /&gt;
        return false;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Make sure the hello record is valid&lt;br /&gt;
    if (!$row-&amp;gt;check()) {&lt;br /&gt;
        $this-&amp;gt;setError($this-&amp;gt;_db-&amp;gt;getErrorMsg());&lt;br /&gt;
        return false;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Store the web link table to the database&lt;br /&gt;
    if (!$row-&amp;gt;store()) {&lt;br /&gt;
        $this-&amp;gt;setError($this-&amp;gt;_db-&amp;gt;getErrorMsg());&lt;br /&gt;
        return false;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return true;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method gets added to the hello model.&lt;br /&gt;
&lt;br /&gt;
The method takes one parameter, which is an associative array of data that we want to store in the database. This can easily be retrieved from the request as will be seen later.&lt;br /&gt;
&lt;br /&gt;
You will see that the first line retrieves a reference to our JTable object. If we name our table properly, we don&#039;t have to specify its name - the JModel class knows where to find it. You may recall that we called our table class TableHello and put it in a file called hello.php in the tables directory. If you follow this convention, the JModel class can create your object automatically.&lt;br /&gt;
&lt;br /&gt;
The second line will retrieve the data from the form. The JRequest class makes this very easy. In this case, we are retrieving all of the variables that were submitted using the &#039;POST&#039; method. These will be returned as an associative array.&lt;br /&gt;
&lt;br /&gt;
The rest is easy - we bind, check and store. The [http://docs.joomla.org/API15:JTable/bind bind()] method will copy values from the array into the corresponding property of the table object. In this case, it will take the values of id and greeting and copy them to our TableHello object.&lt;br /&gt;
&lt;br /&gt;
The [http://docs.joomla.org/API15:JTable/check check()] method will perform data verification. In the JTable() class, this method simply returns true. While this doesn&#039;t provide any value for us currently, by calling this method we make it possible to do data checking using our TableHello class in the future. This method can be overridden in our TableHello class with a method that performs the appropriate checks.&lt;br /&gt;
&lt;br /&gt;
The [http://docs.joomla.org/API15:JTable/store store()] method will take the data that is in the object and store it in the database. If the id is 0, it will create a new record (INSERT), otherwise, it will update the existing record (UPDATE).&lt;br /&gt;
&lt;br /&gt;
== Adding the Task to the Controller ==&lt;br /&gt;
&lt;br /&gt;
We are now ready to add our task to the controller. Since the task that we are firing is called &#039;save&#039;, we must call our method &#039;save&#039;. This is simple:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * save a record (and redirect to main page)&lt;br /&gt;
 * @return void&lt;br /&gt;
 */&lt;br /&gt;
function save()&lt;br /&gt;
{&lt;br /&gt;
    $model = $this-&amp;gt;getModel(&#039;hello&#039;);&lt;br /&gt;
&lt;br /&gt;
    if ($model-&amp;gt;store()) {&lt;br /&gt;
        $msg = JText::_( &#039;Greeting Saved!&#039; );&lt;br /&gt;
    } else {&lt;br /&gt;
        $msg = JText::_( &#039;Error Saving Greeting&#039; );&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Check the table in so it can be edited.... we are done with it anyway&lt;br /&gt;
    $link = &#039;index.php?option=com_hello&#039;;&lt;br /&gt;
    $this-&amp;gt;setRedirect($link, $msg);&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All we do is get our model and invoke the store() method. Then we use the setRedirect() method to redirect back to our list of greetings. We also pass a message along, which will be displayed at the top of the page.&lt;br /&gt;
&lt;br /&gt;
=== Deleting a Record ===&lt;br /&gt;
&lt;br /&gt;
=== Implementing the Function in the Model ===&lt;br /&gt;
&lt;br /&gt;
In the model, we will retrieve the list of IDs to delete and call the JTable class to delete them. Here it is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * Method to delete record(s)&lt;br /&gt;
 *&lt;br /&gt;
 * @access    public&lt;br /&gt;
 * @return    boolean    True on success&lt;br /&gt;
 */&lt;br /&gt;
function delete()&lt;br /&gt;
{&lt;br /&gt;
    $cids = JRequest::getVar( &#039;cid&#039;, array(0), &#039;post&#039;, &#039;array&#039; );&lt;br /&gt;
    $row =&amp;amp; $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
    foreach($cids as $cid) {&lt;br /&gt;
        if (!$row-&amp;gt;delete( $cid )) {&lt;br /&gt;
            $this-&amp;gt;setError( $row-&amp;gt;getErrorMsg() );&lt;br /&gt;
            return false;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return true;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We invoke the JRequest::getVar() method to get the data from the request, then we invoke the $row-&amp;gt;delete() method to delete each row. By storing errors in the model we make it possible to retrieve them later if we so choose.&lt;br /&gt;
&lt;br /&gt;
=== Handling the Remove Task in the Controller ===&lt;br /&gt;
&lt;br /&gt;
This is similar to the save() method which handled the save task:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * remove record(s)&lt;br /&gt;
 * @return void&lt;br /&gt;
 */&lt;br /&gt;
function remove()&lt;br /&gt;
{&lt;br /&gt;
    $model = $this-&amp;gt;getModel(&#039;hello&#039;);&lt;br /&gt;
    if(!$model-&amp;gt;delete()) {&lt;br /&gt;
        $msg = JText::_( &#039;Error: One or More Greetings Could not be Deleted&#039; );&lt;br /&gt;
    } else {&lt;br /&gt;
        $msg = JText::_( &#039;Greeting(s) Deleted&#039; );&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    $this-&amp;gt;setRedirect( &#039;index.php?option=com_hello&#039;, $msg );&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Cancelling the Edit Operation ====&lt;br /&gt;
&lt;br /&gt;
To cancel the edit operation, all we have to do is redirect back to the main view:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * cancel editing a record&lt;br /&gt;
 * @return void&lt;br /&gt;
 */&lt;br /&gt;
function cancel()&lt;br /&gt;
{&lt;br /&gt;
    $msg = JText::_( &#039;Operation Cancelled&#039; );&lt;br /&gt;
    $this-&amp;gt;setRedirect( &#039;index.php?option=com_hello&#039;, $msg );&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
We have now implemented a basic backend to our component. We are now able to edit the entries that are viewed in the frontend. We have demonstrated the interaction between models, views and controllers. We have shown how the JTable class can be extended to provide easy access to tables in the database. It can also be seen how the JToolBarHelper class can be used to create button bars in components to present a standardized look between components.&lt;br /&gt;
&lt;br /&gt;
== Articles in this Series ==&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 1]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 2 - Adding a Model]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 3 - Using the Database]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 4 - Creating an Administrator Interface]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 5 - Basic Backend Framework]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 6 - Adding Backend Actions]]&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
* staalanden&lt;br /&gt;
* jamesconroyuk&lt;br /&gt;
&lt;br /&gt;
== Download ==&lt;br /&gt;
&lt;br /&gt;
The component can be downloaded at: [http://joomlacode.org/gf/download/frsrelease/8111/29436/com_hello4_01.zip com_hello4_01]&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Kissaki</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J1.5:Developing_a_MVC_Component/Adding_Backend_Actions&amp;diff=30638</id>
		<title>J1.5:Developing a MVC Component/Adding Backend Actions</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J1.5:Developing_a_MVC_Component/Adding_Backend_Actions&amp;diff=30638"/>
		<updated>2010-09-12T15:19:16Z</updated>

		<summary type="html">&lt;p&gt;Kissaki: /* The Hello Controller */ fix&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This article focuses on adding functionality to the current &#039;&#039;dumb&#039;&#039; page/article for the administrator. For an administrator the current default view is pretty useless. It doesn&#039;t really do anything - all it does is display the entries that we have in our database.&lt;br /&gt;
&lt;br /&gt;
In order to make it useful, we need to add some buttons and links. This article extends the component with content management tasks. Add, Change and Delete are the typical tasks that will be added.&lt;br /&gt;
&lt;br /&gt;
==Adding interaction ==&lt;br /&gt;
Interaction will be added on two levels. Within the administrator framework by means of Toolbar extension and within the article itself by means of reference links and form postings. For basic understanding see [[Developing a Model-View-Controller Component - Part 4 - Creating an Administrator Interface]].&lt;br /&gt;
&lt;br /&gt;
=== The Toolbar ===&lt;br /&gt;
&lt;br /&gt;
You may have noticed the toolbar that appears at the top of other Joomla! component administrator panels. Our component needs one as well. Joomla! makes this very easy to do. We will add buttons Delete records, Edit records, and create New records. We will also add a title that will be displayed on our toolbar.&lt;br /&gt;
&lt;br /&gt;
This is done by adding code to the view. To add the buttons, we use static methods from the Joomla! JToolBarHelper class. The code looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;JToolBarHelper::title(   JText::_( &#039;Hello Manager&#039; ), &#039;generic.png&#039; );&lt;br /&gt;
JToolBarHelper::deleteList();&lt;br /&gt;
JToolBarHelper::editListX();&lt;br /&gt;
JToolBarHelper::addNewX();&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These three methods will create the appropriate buttons. The deleteList() method can optionally take up to three parameters - the first parameter is a string to display to the user to confirm that they want to delete the records. The second is the task that should be sent with the query (the default is &#039;remove&#039;), and the third is the text that should be displayed below the button.&lt;br /&gt;
&lt;br /&gt;
The editListX() and addNewX() methods can each take two optional parameters. The first is the task (which are by default edit and add, respectively), and the second is the text that should be displayed below the button.&lt;br /&gt;
&lt;br /&gt;
*You may have noticed the use of the JText::_ method in the template before and here as well. This is a handy function that makes component translation much easier. The JText::_ method will look up the string in your component language file and return the translated string. If no translation text is found, it will return the string that you passed to it. If you want to translate your component into another language, all you have to do is create a language file that will map the strings within the quotes to the translated version of the string.&lt;br /&gt;
&lt;br /&gt;
=== Checkboxes and Links ===&lt;br /&gt;
&lt;br /&gt;
We now have buttons. Two of those buttons operate on existing records. But how do we know which records to operate on? We have to let the user tell us. To do this, we need to add checkboxes to our table so that the user can select certain records. This is done in our template.&lt;br /&gt;
&lt;br /&gt;
In order to the add the checkboxes, we need to add an extra column into our table. We will add the column in between the two that we already have.&lt;br /&gt;
&lt;br /&gt;
In the header of the column, we will add a checkbox which can be used to toggle all the boxes below it on or off:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;th width=&amp;quot;20&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input type=&amp;quot;checkbox&amp;quot; name=&amp;quot;toggle&amp;quot; value=&amp;quot;&amp;quot; onclick=&amp;quot;checkAll(&amp;lt;?php echo count( $this-&amp;gt;items ); ?&amp;gt;);&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/th&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Javascript checkAll function is a function that is built into the Joomla! base Javascript package that provides the functionality that we want here.&lt;br /&gt;
&lt;br /&gt;
Now we need to add the checkboxes into the individual rows. Joomla!&#039;s JHTML class has a method, JHTML::_(), which will generate our checkbox for us. We will add the following line to our loop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;$checked    = JHTML::_( &#039;grid.id&#039;, $i, $row-&amp;gt;id );&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
after the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;$row =&amp;amp; $this-&amp;gt;items[$i];&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we will add a cell in between the two that we already have:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
    &amp;lt;?php echo $checked; ?&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be cumbersome to have to check the box that we want to edit and then move up and click the edit button. Therefore, we will add a link so that it will go straight to the greeting&#039;s edit form. We will add the following line after the call to the JHTML::_() method to generate the link HTML:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;$link = JRoute::_( &#039;index.php?option=com_hello&amp;amp;controller=hello&amp;amp;task=edit&amp;amp;cid[]=&#039;. $row-&amp;gt;id );&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And we include the link in the cell showing the greeting text:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
    &amp;lt;a href=&amp;quot;&amp;lt;?php echo $link; ?&amp;gt;&amp;quot;&amp;gt;&amp;lt;?php echo $row-&amp;gt;greeting; ?&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that this link points to the hello controller. This controller will handle the data manipulation of our greetings.&lt;br /&gt;
&lt;br /&gt;
If you recall from above, we had four hidden input fields at the bottom of our form. The first input field was named &#039;option&#039;. This field is necessary so that we stay in our component. The second input field was task. This form property gets set when one of the buttons in the toolbar is clicked. A Javascript error will result and the buttons will not work if this input field is omitted. The third input field is the boxchecked field. This field keeps track of the number of boxes that are checked. The edit and delete buttons will check to ensure that this is greater than zero and will not allow the form to be submitted if it is not. The fourth input field is the controller field. This is used to specify that tasks fired from this form will be handled by the hello controller.&lt;br /&gt;
&lt;br /&gt;
Here is the code for the completed default.php file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;); ?&amp;gt;&lt;br /&gt;
&amp;lt;form action=&amp;quot;index.php&amp;quot; method=&amp;quot;post&amp;quot; name=&amp;quot;adminForm&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;editcell&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;table class=&amp;quot;adminlist&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;thead&amp;gt;&lt;br /&gt;
        &amp;lt;tr&amp;gt;&lt;br /&gt;
            &amp;lt;th width=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;?php echo JText::_( &#039;ID&#039; ); ?&amp;gt;&lt;br /&gt;
            &amp;lt;/th&amp;gt;&lt;br /&gt;
            &amp;lt;th width=&amp;quot;20&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;input type=&amp;quot;checkbox&amp;quot; name=&amp;quot;toggle&amp;quot; value=&amp;quot;&amp;quot; onclick=&amp;quot;checkAll(&amp;lt;?php echo count( $this-&amp;gt;items ); ?&amp;gt;);&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;/th&amp;gt;&lt;br /&gt;
            &amp;lt;th&amp;gt;&lt;br /&gt;
                &amp;lt;?php echo JText::_( &#039;Greeting&#039; ); ?&amp;gt;&lt;br /&gt;
            &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;            &lt;br /&gt;
    &amp;lt;/thead&amp;gt;&lt;br /&gt;
    &amp;lt;?php&lt;br /&gt;
    $k = 0;&lt;br /&gt;
    for ($i=0, $n=count( $this-&amp;gt;items ); $i &amp;lt; $n; $i++)&lt;br /&gt;
    {&lt;br /&gt;
        $row =&amp;amp; $this-&amp;gt;items[$i];&lt;br /&gt;
        $checked    = JHTML::_( &#039;grid.id&#039;, $i, $row-&amp;gt;id );&lt;br /&gt;
        $link = JRoute::_( &#039;index.php?option=com_hello&amp;amp;controller=hello&amp;amp;task=edit&amp;amp;cid[]=&#039;. $row-&amp;gt;id );&lt;br /&gt;
        &lt;br /&gt;
        ?&amp;gt;&lt;br /&gt;
        &amp;lt;tr class=&amp;quot;&amp;lt;?php echo &amp;quot;row$k&amp;quot;; ?&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;&lt;br /&gt;
                &amp;lt;?php echo $row-&amp;gt;id; ?&amp;gt;&lt;br /&gt;
            &amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;&lt;br /&gt;
              &amp;lt;?php echo $checked; ?&amp;gt;&lt;br /&gt;
            &amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;&lt;br /&gt;
                &amp;lt;a href=&amp;quot;&amp;lt;?php echo $link; ?&amp;gt;&amp;quot;&amp;gt;&amp;lt;?php echo $row-&amp;gt;greeting; ?&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
            &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;?php&lt;br /&gt;
        $k = 1 - $k;&lt;br /&gt;
    }&lt;br /&gt;
    ?&amp;gt;&lt;br /&gt;
    &amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;option&amp;quot; value=&amp;quot;com_hello&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;task&amp;quot; value=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;boxchecked&amp;quot; value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;controller&amp;quot; value=&amp;quot;hello&amp;quot; /&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/form&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Our hellos view is now complete.&lt;br /&gt;
&lt;br /&gt;
== Getting Down and Dirty: Doing the Real Work ==&lt;br /&gt;
&lt;br /&gt;
Now that the Hellos view is done, it is time to move to the Hello controller and model. This is where the real work will get done.&lt;br /&gt;
&lt;br /&gt;
==== The Hello Controller ====&lt;br /&gt;
&lt;br /&gt;
Our default controller just isn&#039;t going to cut it when it comes to doing work - all it is capable of doing is displaying views.&lt;br /&gt;
&lt;br /&gt;
We need to be able to handle the tasks that we are launching from the Hellos view: add, edit and remove. The singular named Hello controller is created (and located in the controllers sub-directory) to actually add, edit and remove the individual entries.&lt;br /&gt;
&lt;br /&gt;
Add and edit are essentially the same task: they both display a form to the user that allows a greeting to be edited. The only difference is that new displays a blank form, and edit displays a form with data already in it. Since they are similar, we will map the add task onto the edit task handler. This is specified in our constructor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * constructor (registers additional tasks to methods)&lt;br /&gt;
 * @return void&lt;br /&gt;
 */&lt;br /&gt;
function __construct()&lt;br /&gt;
{&lt;br /&gt;
    parent::__construct();&lt;br /&gt;
&lt;br /&gt;
    // Register Extra tasks&lt;br /&gt;
    $this-&amp;gt;registerTask( &#039;add&#039;  ,     &#039;edit&#039; );&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first parameter of JController::registerTask is the task to map, and the second is the method to map it to.&lt;br /&gt;
&lt;br /&gt;
We will start with handling the edit task. The controller&#039;s job is fairly simple for the edit task. All it has to do is specify the view and layout to load (the hello view and the form layout). We will also tell Joomla! to disable the mainmenu while we are editing our greeting. This prevents users from leaving unsaved records open.&lt;br /&gt;
&lt;br /&gt;
Our edit task handler looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * display the edit form&lt;br /&gt;
 * @return void&lt;br /&gt;
 */&lt;br /&gt;
function edit()&lt;br /&gt;
{&lt;br /&gt;
    JRequest::setVar( &#039;view&#039;, &#039;hello&#039; );&lt;br /&gt;
    JRequest::setVar( &#039;layout&#039;, &#039;form&#039;  );&lt;br /&gt;
    JRequest::setVar(&#039;hidemainmenu&#039;, 1);&lt;br /&gt;
&lt;br /&gt;
    parent::display();&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE on naming conventions:  The top calling program (hello.php) makes assumptions about the file names and class names of the controllers.  To summarize for this example: &lt;br /&gt;
&lt;br /&gt;
   Default controller path:    …/controller.php&lt;br /&gt;
   Default controller class name:  HelloController&lt;br /&gt;
&lt;br /&gt;
   Requested controller path …/controllers/&amp;lt;requestName&amp;gt;.php&lt;br /&gt;
   Requested controller class name:  HelloController&amp;lt;requestName&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The code for the controller at admin/controllers/hello.php:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Controller for Hello World Component&lt;br /&gt;
 * &lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_4&lt;br /&gt;
 * @license		GNU/GPL&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access&lt;br /&gt;
defined( &#039;_JEXEC&#039; ) or die( &#039;Restricted access&#039; );&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Hello Controller&lt;br /&gt;
 *&lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 */&lt;br /&gt;
class HellosControllerHello extends HellosController&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * constructor (registers additional tasks to methods)&lt;br /&gt;
	 * @return void&lt;br /&gt;
	 */&lt;br /&gt;
	function __construct()&lt;br /&gt;
	{&lt;br /&gt;
		parent::__construct();&lt;br /&gt;
&lt;br /&gt;
		// Register Extra tasks&lt;br /&gt;
		$this-&amp;gt;registerTask( &#039;add&#039;  , 	&#039;edit&#039; );&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * display the edit form&lt;br /&gt;
	 * @return void&lt;br /&gt;
	 */&lt;br /&gt;
	function edit()&lt;br /&gt;
	{&lt;br /&gt;
		JRequest::setVar( &#039;view&#039;, &#039;hello&#039; );&lt;br /&gt;
		JRequest::setVar( &#039;layout&#039;, &#039;form&#039;  );&lt;br /&gt;
		JRequest::setVar(&#039;hidemainmenu&#039;, 1);&lt;br /&gt;
&lt;br /&gt;
		parent::display();&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Hello View ====&lt;br /&gt;
&lt;br /&gt;
The Hello view will display a form which will allow the user to edit a greeting. The display method if the hello view has to do a few simple tasks:&lt;br /&gt;
&lt;br /&gt;
* retrieve the data from the model&lt;br /&gt;
* create the toolbar&lt;br /&gt;
* pass the data into the template&lt;br /&gt;
* invoke the display() method to render the template&lt;br /&gt;
&lt;br /&gt;
This becomes a bit more complicated because the one view handles both the edit and add tasks. In our toolbar we want the user to know whether they are adding or editing, so we have to determine which task was fired.&lt;br /&gt;
&lt;br /&gt;
Since we are already retrieving the record that we want to display from the model, we can use this data to determine what task was fired. If the task was edit, then the id field of our record will have been set. If the task was new, then it will not have been set. This can be used to determine if we have a new record or an existing record.&lt;br /&gt;
&lt;br /&gt;
We will add two buttons to the toolbar: save and cancel. Though the functionality will be the same, we want to display different buttons depending on whether it is a new or existing record. If it is a new record, we will display cancel. If it already exists, we will display close.&lt;br /&gt;
&lt;br /&gt;
Thus our display method looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * display method of Hello view&lt;br /&gt;
 * @return void&lt;br /&gt;
 **/&lt;br /&gt;
function display($tpl = null)&lt;br /&gt;
{&lt;br /&gt;
    //get the hello&lt;br /&gt;
    $hello        =&amp;amp; $this-&amp;gt;get(&#039;Data&#039;);&lt;br /&gt;
    $isNew        = ($hello-&amp;gt;id &amp;lt; 1);&lt;br /&gt;
&lt;br /&gt;
    $text = $isNew ? JText::_( &#039;New&#039; ) : JText::_( &#039;Edit&#039; );&lt;br /&gt;
    JToolBarHelper::title(   JText::_( &#039;Hello&#039; ).&#039;: &amp;lt;small&amp;gt;&amp;lt;small&amp;gt;[ &#039; . $text.&#039; ]&amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt;&#039; );&lt;br /&gt;
    JToolBarHelper::save();&lt;br /&gt;
    if ($isNew)  {&lt;br /&gt;
        JToolBarHelper::cancel();&lt;br /&gt;
    } else {&lt;br /&gt;
        // for existing items the button is renamed `close`&lt;br /&gt;
        JToolBarHelper::cancel( &#039;cancel&#039;, &#039;Close&#039; );&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    $this-&amp;gt;assignRef(&#039;hello&#039;, $hello);&lt;br /&gt;
    parent::display($tpl);&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The code for the view at admin/views/hello/view.html.php:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * Hello View for Hello World Component&lt;br /&gt;
 * &lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_4&lt;br /&gt;
 * @license		GNU/GPL&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access&lt;br /&gt;
defined( &#039;_JEXEC&#039; ) or die( &#039;Restricted access&#039; );&lt;br /&gt;
&lt;br /&gt;
jimport( &#039;joomla.application.component.view&#039; );&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello View&lt;br /&gt;
 *&lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 */&lt;br /&gt;
class HellosViewHello extends JView&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * display method of Hello view&lt;br /&gt;
	 * @return void&lt;br /&gt;
	 **/&lt;br /&gt;
	function display($tpl = null)&lt;br /&gt;
	{&lt;br /&gt;
		//get the hello&lt;br /&gt;
		$hello		=&amp;amp; $this-&amp;gt;get(&#039;Data&#039;);&lt;br /&gt;
		$isNew		= ($hello-&amp;gt;id &amp;lt; 1);&lt;br /&gt;
&lt;br /&gt;
		$text = $isNew ? JText::_( &#039;New&#039; ) : JText::_( &#039;Edit&#039; );&lt;br /&gt;
		JToolBarHelper::title(   JText::_( &#039;Hello&#039; ).&#039;: &amp;lt;small&amp;gt;&amp;lt;small&amp;gt;[ &#039; . $text.&#039; ]&amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt;&#039; );&lt;br /&gt;
		JToolBarHelper::save();&lt;br /&gt;
		if ($isNew)  {&lt;br /&gt;
			JToolBarHelper::cancel();&lt;br /&gt;
		} else {&lt;br /&gt;
			// for existing items the button is renamed `close`&lt;br /&gt;
			JToolBarHelper::cancel( &#039;cancel&#039;, &#039;Close&#039; );&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$this-&amp;gt;assignRef(&#039;hello&#039;,		$hello);&lt;br /&gt;
&lt;br /&gt;
		parent::display($tpl);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Hello Model ====&lt;br /&gt;
&lt;br /&gt;
Our view needs data. Therefore, we need to create a model to model a hello.&lt;br /&gt;
&lt;br /&gt;
Our model will have two properties: _id and _data. _id will hold the id of the greeting and data will hold the data.&lt;br /&gt;
&lt;br /&gt;
We will start with a constructor, which will attempt to retrieve the id from the query:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * Constructor that retrieves the ID from the request&lt;br /&gt;
 *&lt;br /&gt;
 * @access    public&lt;br /&gt;
 * @return    void&lt;br /&gt;
 */&lt;br /&gt;
function __construct()&lt;br /&gt;
{&lt;br /&gt;
    parent::__construct();&lt;br /&gt;
&lt;br /&gt;
    $array = JRequest::getVar(&#039;cid&#039;,  0, &#039;&#039;, &#039;array&#039;);&lt;br /&gt;
    $this-&amp;gt;setId((int)$array[0]);&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The JRequest::getVar() method is used to retrieve data from the request. The first parameter is the name of the form variable. The second parameter is the default value to assign if there is no value found. The third parameter is the name of the hash to retrieve the value from (get, post, etc), and the last value is the data type that should be forced on the value.&lt;br /&gt;
&lt;br /&gt;
Our constructor will take the first value from the cid array and assign it to the id.&lt;br /&gt;
&lt;br /&gt;
Our setId() method can be used to set our id. Changing the id that our model points to will mean the id points to the wrong data. Therefore, when we set the id, we will clear the data property:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * Method to set the hello identifier&lt;br /&gt;
 *&lt;br /&gt;
 * @access    public&lt;br /&gt;
 * @param    int Hello identifier&lt;br /&gt;
 * @return    void&lt;br /&gt;
 */&lt;br /&gt;
function setId($id)&lt;br /&gt;
{&lt;br /&gt;
    // Set id and wipe data&lt;br /&gt;
    $this-&amp;gt;_id        = $id;&lt;br /&gt;
    $this-&amp;gt;_data    = null;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we need a method to retrieve our data: getData()&lt;br /&gt;
&lt;br /&gt;
getData will check if the _data property has already been set. If it has, it will simply return it. Otherwise, it will load the data from the database.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * Method to get a hello&lt;br /&gt;
 * @return object with data&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
function &amp;amp;getData()&lt;br /&gt;
{&lt;br /&gt;
    // Load the data&lt;br /&gt;
    if (empty( $this-&amp;gt;_data )) {&lt;br /&gt;
        $query = &#039; SELECT * FROM #__hello &#039;.&lt;br /&gt;
                &#039;  WHERE id = &#039;.$this-&amp;gt;_id;&lt;br /&gt;
        $this-&amp;gt;_db-&amp;gt;setQuery( $query );&lt;br /&gt;
        $this-&amp;gt;_data = $this-&amp;gt;_db-&amp;gt;loadObject();&lt;br /&gt;
    }&lt;br /&gt;
    if (!$this-&amp;gt;_data) {&lt;br /&gt;
        $this-&amp;gt;_data = new stdClass();&lt;br /&gt;
        $this-&amp;gt;_data-&amp;gt;id = 0;&lt;br /&gt;
        $this-&amp;gt;_data-&amp;gt;greeting = null;&lt;br /&gt;
    }&lt;br /&gt;
    return $this-&amp;gt;_data;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Form ====&lt;br /&gt;
&lt;br /&gt;
Now all that is left is to create the form that the data will go into. Since we specified our layout as form, the form will go in a file in the tmpl directory of the hello view called form.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;); ?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;form action=&amp;quot;index.php&amp;quot; method=&amp;quot;post&amp;quot; name=&amp;quot;adminForm&amp;quot; id=&amp;quot;adminForm&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;col100&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;fieldset class=&amp;quot;adminform&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;legend&amp;gt;&amp;lt;?php echo JText::_( &#039;Details&#039; ); ?&amp;gt;&amp;lt;/legend&amp;gt;&lt;br /&gt;
        &amp;lt;table class=&amp;quot;admintable&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;tr&amp;gt;&lt;br /&gt;
            &amp;lt;td width=&amp;quot;100&amp;quot; align=&amp;quot;right&amp;quot; class=&amp;quot;key&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;label for=&amp;quot;greeting&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;?php echo JText::_( &#039;Greeting&#039; ); ?&amp;gt;:&lt;br /&gt;
                &amp;lt;/label&amp;gt;&lt;br /&gt;
            &amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;&lt;br /&gt;
                &amp;lt;input class=&amp;quot;text_area&amp;quot; type=&amp;quot;text&amp;quot; name=&amp;quot;greeting&amp;quot; id=&amp;quot;greeting&amp;quot; size=&amp;quot;32&amp;quot; maxlength=&amp;quot;250&amp;quot; value=&amp;quot;&amp;lt;?php echo $this-&amp;gt;hello-&amp;gt;greeting;?&amp;gt;&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;/table&amp;gt;&lt;br /&gt;
    &amp;lt;/fieldset&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;clr&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;option&amp;quot; value=&amp;quot;com_hello&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;id&amp;quot; value=&amp;quot;&amp;lt;?php echo $this-&amp;gt;hello-&amp;gt;id; ?&amp;gt;&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;task&amp;quot; value=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;controller&amp;quot; value=&amp;quot;hello&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that in addition to the input field, there is a hidden field for the id. The user doesn&#039;t need to edit the id (and shouldn&#039;t), so we silently pass it along in the form.&lt;br /&gt;
&lt;br /&gt;
==== Implementing the Functionality ====&lt;br /&gt;
&lt;br /&gt;
So far, our controller only handles two tasks: edit and new. However, we also have buttons to save, delete and cancel records. We need to write code to handle and perform these tasks.&lt;br /&gt;
&lt;br /&gt;
=== Saving a Record ===&lt;br /&gt;
&lt;br /&gt;
The logical next step is to implement the functionality to save a record. Normally, this would require some switches and logic to handle various cases, such as the difference between creating a new record (an INSERT query), and updating an existing query (an UPDATE query). Also, there are complexities involved in getting the data from the form and putting it into the query.&lt;br /&gt;
&lt;br /&gt;
The Joomla! framework takes care of a lot of this for you. The JTable class makes it easy to manipulate records in the database without having to worry about writing the SQL code that lies behind these updates. It also makes it easy to transfer data from an HTML form into the database.&lt;br /&gt;
&lt;br /&gt;
== Creating the Table Class ==&lt;br /&gt;
&lt;br /&gt;
The JTable class is an abstract class from which you can derive child classes to work with specific tables. To use it, you simply create a class that extends the JTable class, add your database fields as properties, and override the constructor to specify the name of the table and the primary key.&lt;br /&gt;
&lt;br /&gt;
Here is our JTable class:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * Hello World table class&lt;br /&gt;
 * &lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_4&lt;br /&gt;
 * @license        GNU/GPL&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Table class&lt;br /&gt;
 *&lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 */&lt;br /&gt;
class TableHello extends JTable&lt;br /&gt;
{&lt;br /&gt;
    /**&lt;br /&gt;
     * Primary Key&lt;br /&gt;
     *&lt;br /&gt;
     * @var int&lt;br /&gt;
     */&lt;br /&gt;
    var $id = null;&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * @var string&lt;br /&gt;
     */&lt;br /&gt;
    var $greeting = null;&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Constructor&lt;br /&gt;
     *&lt;br /&gt;
     * @param object Database connector object&lt;br /&gt;
     */&lt;br /&gt;
    function __construct( &amp;amp;$db ) {&lt;br /&gt;
        parent::__construct(&#039;#__hello&#039;, &#039;id&#039;, $db);&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see here that we have defined our two fields: the id field and the greeting field. Then we have defined a constructor, which will call the constructor of the parent class and pass it the name of the table (hello), the name of the field which is the primary key (id), and the database connector object.&lt;br /&gt;
&lt;br /&gt;
This file should be called hello.php and it will go in a directory called tables in the administrator section of our component.&lt;br /&gt;
&lt;br /&gt;
== Implementing the Function in our Model ==&lt;br /&gt;
&lt;br /&gt;
We are now ready to add the method to the model which will save our record. We will call this method store. Our store() method will do three things: bind the data from the form to the TableHello object, check to ensure that the record is properly formed, and store the record in the database.&lt;br /&gt;
&lt;br /&gt;
Our method looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * Method to store a record&lt;br /&gt;
 *&lt;br /&gt;
 * @access    public&lt;br /&gt;
 * @return    boolean    True on success&lt;br /&gt;
 */&lt;br /&gt;
function store()&lt;br /&gt;
{&lt;br /&gt;
    $row =&amp;amp; $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
    $data = JRequest::get( &#039;post&#039; );&lt;br /&gt;
    // Bind the form fields to the hello table&lt;br /&gt;
    if (!$row-&amp;gt;bind($data)) {&lt;br /&gt;
        $this-&amp;gt;setError($this-&amp;gt;_db-&amp;gt;getErrorMsg());&lt;br /&gt;
        return false;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Make sure the hello record is valid&lt;br /&gt;
    if (!$row-&amp;gt;check()) {&lt;br /&gt;
        $this-&amp;gt;setError($this-&amp;gt;_db-&amp;gt;getErrorMsg());&lt;br /&gt;
        return false;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Store the web link table to the database&lt;br /&gt;
    if (!$row-&amp;gt;store()) {&lt;br /&gt;
        $this-&amp;gt;setError($this-&amp;gt;_db-&amp;gt;getErrorMsg());&lt;br /&gt;
        return false;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return true;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method gets added to the hello model.&lt;br /&gt;
&lt;br /&gt;
The method takes one parameter, which is an associative array of data that we want to store in the database. This can easily be retrieved from the request as will be seen later.&lt;br /&gt;
&lt;br /&gt;
You will see that the first line retrieves a reference to our JTable object. If we name our table properly, we don&#039;t have to specify its name - the JModel class knows where to find it. You may recall that we called our table class TableHello and put it in a file called hello.php in the tables directory. If you follow this convention, the JModel class can create your object automatically.&lt;br /&gt;
&lt;br /&gt;
The second line will retrieve the data from the form. The JRequest class makes this very easy. In this case, we are retrieving all of the variables that were submitted using the &#039;POST&#039; method. These will be returned as an associative array.&lt;br /&gt;
&lt;br /&gt;
The rest is easy - we bind, check and store. The [http://docs.joomla.org/API15:JTable/bind bind()] method will copy values from the array into the corresponding property of the table object. In this case, it will take the values of id and greeting and copy them to our TableHello object.&lt;br /&gt;
&lt;br /&gt;
The [http://docs.joomla.org/API15:JTable/check check()] method will perform data verification. In the JTable() class, this method simply returns true. While this doesn&#039;t provide any value for us currently, by calling this method we make it possible to do data checking using our TableHello class in the future. This method can be overridden in our TableHello class with a method that performs the appropriate checks.&lt;br /&gt;
&lt;br /&gt;
The [http://docs.joomla.org/API15:JTable/store store()] method will take the data that is in the object and store it in the database. If the id is 0, it will create a new record (INSERT), otherwise, it will update the existing record (UPDATE).&lt;br /&gt;
&lt;br /&gt;
== Adding the Task to the Controller ==&lt;br /&gt;
&lt;br /&gt;
We are now ready to add our task to the controller. Since the task that we are firing is called &#039;save&#039;, we must call our method &#039;save&#039;. This is simple:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * save a record (and redirect to main page)&lt;br /&gt;
 * @return void&lt;br /&gt;
 */&lt;br /&gt;
function save()&lt;br /&gt;
{&lt;br /&gt;
    $model = $this-&amp;gt;getModel(&#039;hello&#039;);&lt;br /&gt;
&lt;br /&gt;
    if ($model-&amp;gt;store()) {&lt;br /&gt;
        $msg = JText::_( &#039;Greeting Saved!&#039; );&lt;br /&gt;
    } else {&lt;br /&gt;
        $msg = JText::_( &#039;Error Saving Greeting&#039; );&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Check the table in so it can be edited.... we are done with it anyway&lt;br /&gt;
    $link = &#039;index.php?option=com_hello&#039;;&lt;br /&gt;
    $this-&amp;gt;setRedirect($link, $msg);&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All we do is get our model and invoke the store() method. Then we use the setRedirect() method to redirect back to our list of greetings. We also pass a message along, which will be displayed at the top of the page.&lt;br /&gt;
&lt;br /&gt;
=== Deleting a Record ===&lt;br /&gt;
&lt;br /&gt;
=== Implementing the Function in the Model ===&lt;br /&gt;
&lt;br /&gt;
In the model, we will retrieve the list of IDs to delete and call the JTable class to delete them. Here it is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * Method to delete record(s)&lt;br /&gt;
 *&lt;br /&gt;
 * @access    public&lt;br /&gt;
 * @return    boolean    True on success&lt;br /&gt;
 */&lt;br /&gt;
function delete()&lt;br /&gt;
{&lt;br /&gt;
    $cids = JRequest::getVar( &#039;cid&#039;, array(0), &#039;post&#039;, &#039;array&#039; );&lt;br /&gt;
    $row =&amp;amp; $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
    foreach($cids as $cid) {&lt;br /&gt;
        if (!$row-&amp;gt;delete( $cid )) {&lt;br /&gt;
            $this-&amp;gt;setError( $row-&amp;gt;getErrorMsg() );&lt;br /&gt;
            return false;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return true;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We invoke the JRequest::getVar() method to get the data from the request, then we invoke the $row-&amp;gt;delete() method to delete each row. By storing errors in the model we make it possible to retrieve them later if we so choose.&lt;br /&gt;
&lt;br /&gt;
=== Handling the Remove Task in the Controller ===&lt;br /&gt;
&lt;br /&gt;
This is similar to the save() method which handled the save task:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * remove record(s)&lt;br /&gt;
 * @return void&lt;br /&gt;
 */&lt;br /&gt;
function remove()&lt;br /&gt;
{&lt;br /&gt;
    $model = $this-&amp;gt;getModel(&#039;hello&#039;);&lt;br /&gt;
    if(!$model-&amp;gt;delete()) {&lt;br /&gt;
        $msg = JText::_( &#039;Error: One or More Greetings Could not be Deleted&#039; );&lt;br /&gt;
    } else {&lt;br /&gt;
        $msg = JText::_( &#039;Greeting(s) Deleted&#039; );&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    $this-&amp;gt;setRedirect( &#039;index.php?option=com_hello&#039;, $msg );&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Cancelling the Edit Operation ====&lt;br /&gt;
&lt;br /&gt;
To cancel the edit operation, all we have to do is redirect back to the main view:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * cancel editing a record&lt;br /&gt;
 * @return void&lt;br /&gt;
 */&lt;br /&gt;
function cancel()&lt;br /&gt;
{&lt;br /&gt;
    $msg = JText::_( &#039;Operation Cancelled&#039; );&lt;br /&gt;
    $this-&amp;gt;setRedirect( &#039;index.php?option=com_hello&#039;, $msg );&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
We have now implemented a basic backend to our component. We are now able to edit the entries that are viewed in the frontend. We have demonstrated the interaction between models, views and controllers. We have shown how the JTable class can be extended to provide easy access to tables in the database. It can also be seen how the JToolBarHelper class can be used to create button bars in components to present a standardized look between components.&lt;br /&gt;
&lt;br /&gt;
== Articles in this Series ==&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 1]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 2 - Adding a Model]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 3 - Using the Database]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 4 - Creating an Administrator Interface]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 5 - Basic Backend Framework]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 6 - Adding Backend Actions]]&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
* staalanden&lt;br /&gt;
* jamesconroyuk&lt;br /&gt;
&lt;br /&gt;
== Download ==&lt;br /&gt;
&lt;br /&gt;
The component can be downloaded at: [http://joomlacode.org/gf/download/frsrelease/8111/29436/com_hello4_01.zip com_hello4_01]&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Kissaki</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J1.5:Developing_a_MVC_Component/Basic_Backend_Framework&amp;diff=30637</id>
		<title>J1.5:Developing a MVC Component/Basic Backend Framework</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J1.5:Developing_a_MVC_Component/Basic_Backend_Framework&amp;diff=30637"/>
		<updated>2010-09-12T14:17:19Z</updated>

		<summary type="html">&lt;p&gt;Kissaki: /* The Hellos View */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This article focuses on the entry page/article for the administrator. Whilst the MVC pattern is the same as for the frontend user, this chapter will rapidly go though all steps and setup the backend counter part in the admin section. This article will only focus on setting up the Basic Framework with a list of all the &#039;&#039;Hellos&#039;&#039; but without user interaction. The actual user interaction is added in the succeeding article [[Developing a Model-View-Controller Component - Part 6 - Adding Backend Actions]].&lt;br /&gt;
&lt;br /&gt;
== Tutorial specific naming ==&lt;br /&gt;
Within the next articles the explanation of this administrator section we will keep as close as possible to the component name. For the general overview, lists from the database, we will use &#039;&#039;Hellos&#039;&#039; as identification. The &#039;&#039;Hellos&#039;&#039; naming will be used for viewing and controlling multiple Hellos at once from the database. When selecting a single Hello for Editing or Adding we will use the singular &#039;&#039;Hello&#039;&#039; as naming for the Controller and View. This &#039;&#039;Admin Hello&#039;&#039; has no functional relation with the &#039;&#039;Site Hello&#039;&#039; (the only dependency is the database content, of course).&lt;br /&gt;
&lt;br /&gt;
Where parts 1,2 and 3 of the MVC explanation were working in the site directory tree of com_hello, part 5 and 6 will focus on the admin directory tree. Part 5 and 6 will not add or change files in the site directory tree. Look at the XML file in the attached example of the full com_hello implementation. The XML configuration file will help you with the exact location of the different files being used in this and the following chapter.&lt;br /&gt;
&lt;br /&gt;
== Creating the Basic Framework ==&lt;br /&gt;
&lt;br /&gt;
The basic framework of the administrator panel is very similar to the site portion. The main entry point for the administrator section of the component is hello.php. This file is identical to the hello.php file that was used in the site portion except the name of the controller it loads will be changed to HellosController. The default controller is also called controller.php and this file is identical to the default controller in the site portion, with the exception that the controller is named HellosController instead of HelloController. This difference is so that JController will by default load the hellos view, which will display a list of our greetings.&lt;br /&gt;
&lt;br /&gt;
Here is the listing for hello.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_5&lt;br /&gt;
 * @license    GNU/GPL&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
// No direct access&lt;br /&gt;
&lt;br /&gt;
defined( &#039;_JEXEC&#039; ) or die( &#039;Restricted access&#039; );&lt;br /&gt;
&lt;br /&gt;
// Require the base controller&lt;br /&gt;
&lt;br /&gt;
require_once( JPATH_COMPONENT.DS.&#039;controller.php&#039; );&lt;br /&gt;
&lt;br /&gt;
// Require specific controller if requested&lt;br /&gt;
if($controller = JRequest::getWord(&#039;controller&#039;)) {&lt;br /&gt;
    $path = JPATH_COMPONENT.DS.&#039;controllers&#039;.DS.$controller.&#039;.php&#039;;&lt;br /&gt;
    if (file_exists($path)) {&lt;br /&gt;
        require_once $path;&lt;br /&gt;
    } else {&lt;br /&gt;
        $controller = &#039;&#039;;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Create the controller&lt;br /&gt;
$classname    = &#039;HellosController&#039;.$controller;&lt;br /&gt;
$controller   = new $classname( );&lt;br /&gt;
&lt;br /&gt;
// Perform the Request task&lt;br /&gt;
$controller-&amp;gt;execute( JRequest::getVar( &#039;task&#039; ) );&lt;br /&gt;
&lt;br /&gt;
// Redirect if set by the controller&lt;br /&gt;
$controller-&amp;gt;redirect();&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The view and model that we will start with is the hellos view and the hellos model. We will start with the model.&lt;br /&gt;
&lt;br /&gt;
==== The Hellos Model ====&lt;br /&gt;
&lt;br /&gt;
The Hellos Model will be very simple. The only operation that we currently need is the ability to retrieve the list of hellos from the database. This operation will be implemented in a method called getData().&lt;br /&gt;
&lt;br /&gt;
The JModel class has a built in protected method called _getList(). This method can be used to simplify the task of retrieving a list of records from the database. We simply need to pass it the query and it will return the list of records.&lt;br /&gt;
&lt;br /&gt;
At a later point in time, we might want to use our query from within another method. Therefore, we will create a private method called _buildQuery() which will return the query that will be passed to _getList(). This makes it easier to change the query as well since it is localized in one place.&lt;br /&gt;
&lt;br /&gt;
Therefore we need two methods in our class: getData() and _buildQuery().&lt;br /&gt;
&lt;br /&gt;
_buildQuery() simply returns the query. It looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source  lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * Returns the query&lt;br /&gt;
 * @return string The query to be used to retrieve the rows from the database&lt;br /&gt;
 */&lt;br /&gt;
function _buildQuery()&lt;br /&gt;
{&lt;br /&gt;
    $query = &#039; SELECT * &#039;&lt;br /&gt;
           . &#039; FROM #__hello &#039;&lt;br /&gt;
    ;&lt;br /&gt;
&lt;br /&gt;
    return $query;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
getData() will obtain the query and retrieve the records from the database. Now it might happen that we need to retrieve this list of data twice in one page load. It would be a waste to have to query the database twice. Therefore, we will have this method store the data in a protected property so that on subsequent requests it can simply return the data it has already retrieved. This property will be called _data. (&#039;&#039;&amp;lt;-- Naming convention conflict. Private or Protected data should be preceded with a &#039;_&#039; but as this reference is returned to the view where this data is directly accessed, this data can only be considered as public.&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
Here is the getData() method:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source  lang=&amp;quot;php&amp;quot;&amp;gt;/**&lt;br /&gt;
 * Retrieves the hello data&lt;br /&gt;
 * @return array Array of objects containing the data from the database&lt;br /&gt;
 */&lt;br /&gt;
function getData()&lt;br /&gt;
{&lt;br /&gt;
    // Lets load the data if it doesn&#039;t already exist&lt;br /&gt;
    if (empty( $this-&amp;gt;_data ))&lt;br /&gt;
    {&lt;br /&gt;
        $query = $this-&amp;gt;_buildQuery();&lt;br /&gt;
        $this-&amp;gt;_data = $this-&amp;gt;_getList( $query );&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return $this-&amp;gt;_data;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The completed model looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * Hellos Model for Hello World Component&lt;br /&gt;
 * &lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_5&lt;br /&gt;
 * @license        GNU/GPL&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// Check to ensure this file is included in Joomla!&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die();&lt;br /&gt;
&lt;br /&gt;
jimport( &#039;joomla.application.component.model&#039; );&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Model&lt;br /&gt;
 *&lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 */&lt;br /&gt;
class HellosModelHellos extends JModel&lt;br /&gt;
{&lt;br /&gt;
    /**&lt;br /&gt;
     * Hellos data array&lt;br /&gt;
     *&lt;br /&gt;
     * @var array&lt;br /&gt;
     */&lt;br /&gt;
    var $_data;&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Returns the query&lt;br /&gt;
     * @return string The query to be used to retrieve the rows from the database&lt;br /&gt;
     */&lt;br /&gt;
    function _buildQuery()&lt;br /&gt;
    {&lt;br /&gt;
        $query = &#039; SELECT * &#039;&lt;br /&gt;
            . &#039; FROM #__hello &#039;&lt;br /&gt;
        ;&lt;br /&gt;
        return $query;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Retrieves the hello data&lt;br /&gt;
     * @return array Array of objects containing the data from the database&lt;br /&gt;
     */&lt;br /&gt;
    function getData()&lt;br /&gt;
    {&lt;br /&gt;
        // Lets load the data if it doesn&#039;t already exist&lt;br /&gt;
        if (empty( $this-&amp;gt;_data ))&lt;br /&gt;
        {&lt;br /&gt;
            $query = $this-&amp;gt;_buildQuery();&lt;br /&gt;
            $this-&amp;gt;_data = $this-&amp;gt;_getList( $query );&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        return $this-&amp;gt;_data;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This file is saved as models/hellos.php.&lt;br /&gt;
&lt;br /&gt;
==== The Hellos View ====&lt;br /&gt;
&lt;br /&gt;
Now that we have a model to retrieve our data, we need to display it. This view will be fairly similar to the view from the site section as well.&lt;br /&gt;
&lt;br /&gt;
Just as our model was automatically instantiated in the frontend, so is it in the administrator section. Methods that start with &amp;quot;get&amp;quot; [e.g. getData()] in the model can be accessed using the get() method of the JView class. So our view has three lines: one to retrieve the data from the model, one to push the data into the template, and one to invoke the display method to display the output. Thus we have:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * Hellos View for Hello World Component&lt;br /&gt;
 * &lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_5&lt;br /&gt;
 * @license        GNU/GPL&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// Check to ensure this file is included in Joomla!&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die();&lt;br /&gt;
&lt;br /&gt;
jimport( &#039;joomla.application.component.view&#039; );&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hellos View&lt;br /&gt;
 *&lt;br /&gt;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 */&lt;br /&gt;
class HellosViewHellos extends JView&lt;br /&gt;
{&lt;br /&gt;
    /**&lt;br /&gt;
     * Hellos view display method&lt;br /&gt;
     * @return void&lt;br /&gt;
     **/&lt;br /&gt;
    function display($tpl = null)&lt;br /&gt;
    {&lt;br /&gt;
        JToolBarHelper::title( JText::_( &#039;Hello Manager&#039; ), &#039;generic.png&#039; );&lt;br /&gt;
        JToolBarHelper::deleteList();&lt;br /&gt;
        JToolBarHelper::editListX();&lt;br /&gt;
        JToolBarHelper::addNewX();&lt;br /&gt;
&lt;br /&gt;
        // Get data from the model&lt;br /&gt;
        $items =&amp;amp; $this-&amp;gt;get( &#039;Data&#039;);&lt;br /&gt;
&lt;br /&gt;
        $this-&amp;gt;assignRef( &#039;items&#039;, $items );&lt;br /&gt;
&lt;br /&gt;
        parent::display($tpl);&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This file is saved as views/hellos/view.html.php.&lt;br /&gt;
&lt;br /&gt;
Look carefully at the almost hidden differences compared to &#039;&#039;site&#039;&#039; example. The data is stored in a variable that is encapsulated within the model. Because the data amount is huge due to using the very handy _getList(), the need for returning a reference instead of a value is obvious. This is handled in:&lt;br /&gt;
 $items =&amp;amp; $this-&amp;gt;get( &#039;Data&#039;);&lt;br /&gt;
Looking again at this line and you will notice another difference with respect to the &#039;&#039;site&#039;&#039; view.html.php. The calling of the model function is done implicitly. The actual model function name is getData(). In the &#039;&#039;site&#039;&#039; example you had to call following two lines:&lt;br /&gt;
 $model =&amp;amp; $this-&amp;gt;getModel();&lt;br /&gt;
 $greeting = $model-&amp;gt;getData();&lt;br /&gt;
Both lines are now taken care of by calling: &amp;lt;code&amp;gt;$this-&amp;gt;get( &#039;Data&#039;);&amp;lt;/code&amp;gt;. Under the surface of this &amp;lt;code&amp;gt;get()&amp;lt;/code&amp;gt; the &#039;Data&#039; is prefixed with &#039;get&#039; so when using this function make sure the model functions are preceded with &#039;get&#039;. This function can also be used in the &#039;&#039;site&#039;&#039; section. Keeping the data in the model and accessing it by reference, via &amp;lt;code&amp;gt;get()&amp;lt;/code&amp;gt; methods, is the preferred way of getting data from the model.&lt;br /&gt;
&lt;br /&gt;
==== The Hellos Template ====&lt;br /&gt;
&lt;br /&gt;
The template will take the data pushed into it from the view and produce the output. We will display our output in a simple table. While the frontend template was very simple, in the administrator we will need a minimal amount of extra logic to handle looping through the data.&lt;br /&gt;
&lt;br /&gt;
Here is our template:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;); ?&amp;gt;&lt;br /&gt;
&amp;lt;form action=&amp;quot;index.php&amp;quot; method=&amp;quot;post&amp;quot; name=&amp;quot;adminForm&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;editcell&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;table class=&amp;quot;adminlist&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;thead&amp;gt;&lt;br /&gt;
        &amp;lt;tr&amp;gt;&lt;br /&gt;
            &amp;lt;th width=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;?php echo JText::_( &#039;ID&#039; ); ?&amp;gt;&lt;br /&gt;
            &amp;lt;/th&amp;gt;&lt;br /&gt;
            &amp;lt;th&amp;gt;&lt;br /&gt;
                &amp;lt;?php echo JText::_( &#039;Greeting&#039; ); ?&amp;gt;&lt;br /&gt;
            &amp;lt;/th&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;            &lt;br /&gt;
    &amp;lt;/thead&amp;gt;&lt;br /&gt;
    &amp;lt;?php&lt;br /&gt;
    $k = 0;&lt;br /&gt;
    foreach ($this-&amp;gt;items as &amp;amp;$row)&lt;br /&gt;
    {&lt;br /&gt;
        ?&amp;gt;&lt;br /&gt;
        &amp;lt;tr class=&amp;quot;&amp;lt;?php echo &amp;quot;row$k&amp;quot;; ?&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;&lt;br /&gt;
                &amp;lt;?php echo $row-&amp;gt;id; ?&amp;gt;&lt;br /&gt;
            &amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;&lt;br /&gt;
                &amp;lt;?php echo $row-&amp;gt;greeting; ?&amp;gt;&lt;br /&gt;
            &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;/tr&amp;gt;&lt;br /&gt;
        &amp;lt;?php&lt;br /&gt;
        $k = 1 - $k;&lt;br /&gt;
    }&lt;br /&gt;
    ?&amp;gt;&lt;br /&gt;
    &amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;option&amp;quot; value=&amp;quot;com_hello&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;task&amp;quot; value=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;boxchecked&amp;quot; value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;controller&amp;quot; value=&amp;quot;hello&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/form&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This template is saved as views/hellos/tmpl/default.php.&lt;br /&gt;
&lt;br /&gt;
You will notice that our output is enclosed in a form. Though this is not necessary now, it will be soon.&lt;br /&gt;
&lt;br /&gt;
We have now completed the basic part of the first view. We have added five files to the admin section of our component:&lt;br /&gt;
&lt;br /&gt;
* hello.php&lt;br /&gt;
* controller.php&lt;br /&gt;
* models/hellos.php&lt;br /&gt;
* views/hellos/view.html.php&lt;br /&gt;
* views/hellos/tmpl/default.php&lt;br /&gt;
&lt;br /&gt;
You can now add these files to the XML install file and give it a try!&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
We have now implemented a basic framework for the backend admin component. A list where all of the Hellos are displayed. The next chapter will extend this framework and add user interaction / database manipulation.&lt;br /&gt;
&lt;br /&gt;
== Articles in this Series ==&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 1]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 2 - Adding a Model]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 3 - Using the Database]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 4 - Creating an Administrator Interface]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 5 - Basic Backend Framework]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 6 - Adding Backend Actions]]&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
* staalanden&lt;br /&gt;
* jamesconroyuk&lt;br /&gt;
&lt;br /&gt;
== Download ==&lt;br /&gt;
&lt;br /&gt;
The full admin component can be downloaded at: [http://joomlacode.org/gf/download/frsrelease/8111/29436/com_hello4_01.zip com_hello4_01].&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Kissaki</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J1.5:Developing_a_MVC_Component/Creating_an_Administrator_Interface&amp;diff=30632</id>
		<title>J1.5:Developing a MVC Component/Creating an Administrator Interface</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J1.5:Developing_a_MVC_Component/Creating_an_Administrator_Interface&amp;diff=30632"/>
		<updated>2010-09-11T18:19:12Z</updated>

		<summary type="html">&lt;p&gt;Kissaki: /* Posting Form Data to the Joomla! Engine */  remove rather non-fitting sentence&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{ambox&lt;br /&gt;
| type  = notice&lt;br /&gt;
| image = notice&lt;br /&gt;
| text  = This {{thingamabob}} has been divided into three sections, two new articles are added. Especially this page needs a review&lt;br /&gt;
&amp;lt;small&amp;gt;(August 2009)&amp;lt;/small&amp;gt;}}&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
In the first three Parts, we have developed a MVC component that retrieves its data from a table in the database. Currently, there is no way to add data to the database except to do it manually using another tool. In the next Parts of this tutorial, we will develop an administrator section for our component which will make it possible to manage the entries in the database.&lt;br /&gt;
&lt;br /&gt;
This Part, [[Developing a Model-View-Controller Component - Part 4 - Creating an Administrator Interface | Part 4 - Creating an Administrator Interface]], will be an article with no new source code for our Hello component but will describe some basic details and in-depth explanation of the MVC pattern. This intermediate chapter is not required to complete the Hello model so if you think you understand the basics continue with [[Developing a Model-View-Controller Component - Part 5 - Basic Backend Framework]].&lt;br /&gt;
&lt;br /&gt;
In the frontend solution (site section, parts 1,2 and 3) we developed the first part of our component. The frontend solution is based upon default Controllers, Views and Templates and you were &amp;quot;taken by the hand&amp;quot; and &amp;quot;left to trust&amp;quot; the default handling of the code. This is going to change in the Backend or Administration section of our Hello component ( parts 5 and 6) - we will have to develop all of the code that manages the application flow.&lt;br /&gt;
&lt;br /&gt;
== Site / Admin ==&lt;br /&gt;
Joomla! is a content management system. The &#039;&#039;&#039;frontend&#039;&#039;&#039; is used for presenting the users with content and allows certain logged in users to manipulate the content. The &#039;&#039;&#039;backend&#039;&#039;&#039; is responsible for administering the website framework (structuring / managing / controlling / maintaining). This division between (frontend) site-content and (backend) administration is a fundamental aspect of the Joomla! architecture.&lt;br /&gt;
&lt;br /&gt;
=== Entrance points ===&lt;br /&gt;
From the XML file of our frontend example it was already obvious that there would be an administration part:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;administration&amp;gt;&lt;br /&gt;
  &amp;lt;!--  Administration Menu Section --&amp;gt; &lt;br /&gt;
  &amp;lt;menu&amp;gt;Hello World!&amp;lt;/menu&amp;gt; &lt;br /&gt;
  &amp;lt;!--  Administration Main File Copy Section --&amp;gt; &lt;br /&gt;
  &amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;filename&amp;gt;hello.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;install.sql&amp;lt;/filename&amp;gt; &lt;br /&gt;
  &amp;lt;filename&amp;gt;uninstall.sql&amp;lt;/filename&amp;gt; &lt;br /&gt;
  &amp;lt;/files&amp;gt;&lt;br /&gt;
  &amp;lt;/administration&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Only the .sql files were of use and only during installation for our frontend view, the other two files have no content besides generating a blank page. Access your websites&#039; file system at your hosting provider (or on your own server) and browse through the directories after installing the frontend com_hello component. You may have noticed that our Hello component is to be found twice:&lt;br /&gt;
 &amp;lt;root&amp;gt;/components/com_hello&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/components/com_hello&lt;br /&gt;
&lt;br /&gt;
These two sub-directories link to the previously explained site-content and administration. Administrator interactions explicitly go via the administrator sub-directory, where guest or registered users will enter the default entrance on the root:&lt;br /&gt;
 &amp;lt;root&amp;gt;/index.php&lt;br /&gt;
Administrative users will have to log in, and after logging in they will enter your site via:&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/index.php&lt;br /&gt;
&lt;br /&gt;
With the different access points it is easy to grasp that with setting up the administrator section the naming conventions have no dependency with the site section. Whilst the MVC pattern is also applicable for the administrator section this implies that identical Controllers, Views and Models naming can (and sometimes must) be used as in the site section.&lt;br /&gt;
&lt;br /&gt;
== MVC pattern interaction ==&lt;br /&gt;
[[image:MVC joomla.png|frameless|right]]In [[Developing a Model-View-Controller Component - Part 1]] the figure on the right was used to explain the focus of the first three parts of this &#039;&#039;Developing a Model-View-Controller Component tutorial&#039;&#039;. Now we will use this figure to explain how decisions are made on what is going to be displayed and how to manipulate this.&lt;br /&gt;
&lt;br /&gt;
=== Example roll-out ===&lt;br /&gt;
For explanation purposes an easy to grasp example will be used. A library has the main function of lending books to registered users. Simply laid out there are three tables:&lt;br /&gt;
* users&lt;br /&gt;
* books&lt;br /&gt;
* relation&lt;br /&gt;
&lt;br /&gt;
Lets keep it all very simple. The users are addressed by Id and Name. The books are identified by Id and Title and the relation contains both Ids and the date of lending.&lt;br /&gt;
&lt;br /&gt;
[[image:Library Example.png|400px|frameless|center]]&lt;br /&gt;
&lt;br /&gt;
The example is carefully chosen and will help in explaining the Joomla! architecture in more detail. The administrative side of our Hello component is not even that complex with only one table to manage. After the explanation of this Part it should be easy to follow the tutorial in the succeeding Parts.&lt;br /&gt;
&lt;br /&gt;
=== Mapping a Joomla! MVC component from the example ===&lt;br /&gt;
In this example we will assume that administrative actions (add, edit, delete) are tasks that are to be performed by the administrator. For the frontend user only the view of the Relation table is interesting (&amp;quot;when do I have to bring back the books?&amp;quot;). This example shows the entire list and ignores all privacy stuff that could be taken care of by letting registered users only see their own books. (&#039;&#039;See&#039;&#039;: [http://api.joomla.org/Joomla-Framework/User/JUser.html JUser object] for making user deviations in template module).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Just like our frontend Hello component, for this library component only the default view is being used in the frontend. It lists the relational table, left joining the other two tables to obtain a human readable list of books with their corresponding due date. &lt;br /&gt;
 Alice | One flew over ... | 12-aug-2009&lt;br /&gt;
 Alice | Celeb talk        | 12-aug-2009&lt;br /&gt;
 Mark  | Joomla!           | 15-aug-2009&lt;br /&gt;
&lt;br /&gt;
With respect to the administration part it is important to understand that we have one default and three dedicated views, each controlling three tasks:&lt;br /&gt;
* &amp;lt;Component name default view&amp;gt;&lt;br /&gt;
* User administration&lt;br /&gt;
** Add&lt;br /&gt;
** Change&lt;br /&gt;
** Delete&lt;br /&gt;
* Book administration&lt;br /&gt;
** Add&lt;br /&gt;
** Change&lt;br /&gt;
** Delete&lt;br /&gt;
* Relation administration&lt;br /&gt;
** Add&lt;br /&gt;
** Change&lt;br /&gt;
** Delete&lt;br /&gt;
&lt;br /&gt;
==== Controllers ====&lt;br /&gt;
The main controller of the admin section needs to differentiate between the different Adds, Changes or Deletes that are requested. This is taken care of by creating sub-controllers for each view for handling their specific tasks.&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/controller.php&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/controllers/users.php&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/controllers/books.php&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/controllers/relation.php&lt;br /&gt;
&lt;br /&gt;
The controller is an important part of the MVC pattern. Not only does it take care of the requested tasks, it is also the initiator of instantiating the model with the same name and it is responsible for setting the view and the desired form for that view. The controller really justifies its name. &lt;br /&gt;
&lt;br /&gt;
Within the controller it is good to make a difference between &#039;&#039;&#039;activating tasks&#039;&#039;&#039; (for example the edit selection from a menu) and &#039;&#039;&#039;resulting tasks&#039;&#039;&#039; (for example the result of an edit trigger is the posted data).&lt;br /&gt;
&lt;br /&gt;
Typical controller functions look like:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function &amp;lt;activating task&amp;gt;()  // &amp;lt;-- edit, add, delete &lt;br /&gt;
{&lt;br /&gt;
    JRequest::setVar( &#039;view&#039;, &#039;[&amp;lt;componentname&amp;gt; | users | books | relation ]&#039; );&lt;br /&gt;
    JRequest::setVar( &#039;layout&#039;, &#039;default&#039;  );     // &amp;lt;-- The default form is named here, but in&lt;br /&gt;
                                                  // some complex views, multiple layouts might&lt;br /&gt;
                                                  // be needed.&lt;br /&gt;
    parent::display();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function &amp;lt;resulting task&amp;gt;()  // &amp;lt;-- save, remove&lt;br /&gt;
{&lt;br /&gt;
	$model = $this-&amp;gt;getModel(&#039;[&amp;lt;componentname&amp;gt; | users | books | relation ]&#039;);&lt;br /&gt;
	if(!$model-&amp;gt;action() ) {    // &amp;lt;-- action could be delete() or store()&lt;br /&gt;
		$msg = JText::_( &#039;Error: Could not perform action&#039; );&lt;br /&gt;
	} else {&lt;br /&gt;
		$msg = JText::_( &#039;Action executed&#039; );&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	$this-&amp;gt;setRedirect( &#039;index.php?option=&amp;lt;componentname&amp;gt;&#039;, $msg );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
A controller takes care of all tasks for that dedicated controller. After completing a resulting task the module will return to the main administration entrance point for that component, the main controller with the default view. Activating tasks enforce a new view with a form to display after first defining it.&lt;br /&gt;
&lt;br /&gt;
The explicit definition of the form within a view might raise some eyebrows but our examples are too simple. For the general understanding and consistency this field should mostly be &#039;&#039;default&#039;&#039;. In complex views multiple forms could be defined within one view.&lt;br /&gt;
&lt;br /&gt;
==== Models ====&lt;br /&gt;
The Controllers interact with their equally named Model counter part. In the frontend view the Model was only used to retrieve data. The backend has more controllers and thus also more model files. The backend model files not only are responsible for delivering data to the viewer but also take care of tasks initiated from the controller. A good model contains all actions required to manage a single table in the database.&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/models/&amp;lt;componentname&amp;gt;.php&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/models/users.php&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/models/books.php&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/models/relation.php&lt;br /&gt;
&lt;br /&gt;
==== Views ====&lt;br /&gt;
Separate views are of course also required. For views and subsequent forms no forced naming conventions are required (linking to views is taken care of in the controller). In the following listing the Administrative tasks are identified as a subset for the different views. This choice is totally random and maybe even non-logical but that doesn&#039;t matter for the explanation. Just for example purposes I added also a different view, a delete view, that could be used for all the deletes for all administrative tasks asking an &amp;quot;Are you sure&amp;quot; display.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/views/&amp;lt;componentname&amp;gt;/view.html.php + .../tmpl/default.php&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/views/users/view.html.php           + .../tmpl/default.php&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/views/books/view.html.php           + .../tmpl/default.php&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/views/relation/view.html.php        + .../tmpl/default.php&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/views/delete/view.html.php          + .../tmpl/default.php&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note&#039;&#039;: In general it is good practice to maintain one form per view because the view.html.php still has to deliver the content. With some basic logic you can enable, disable certain content but if this logic is becoming too complex start considering splitting up the view. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note&#039;&#039;: Sharing template parts amongst the different views (for uniform layouting of headers and titles of your component) can be done using the PHP &amp;lt;code&amp;gt;include / require;&amp;lt;/code&amp;gt;. There is one slight problem ... how to make the logical reference? In my modules I have a collector bin for general to use sniplets. Because it involved the views and forms I put this general bin in the views directory. The variable $pathToGeneralView needs to be defined somewhere in the first lines of your file and you have to make sure that the logical reference path is correct (the &#039;..&#039;s). In the following example the files marked with a &#039;*&#039; use the following code:&lt;br /&gt;
&lt;br /&gt;
 ./com_compname/views/general/navigate.header.php  &amp;lt;-- sniplet code for the header&lt;br /&gt;
 ./com_compname/views/general/navigate.footer.php  &amp;lt;-- sniplet code for the footer&lt;br /&gt;
 ./com_compname/views/mngtable1/view.html.php&lt;br /&gt;
 ./com_compname/views/mngtable1/tmpl/default.php *&lt;br /&gt;
 ./com_compname/views/mngtable2/view.html.php&lt;br /&gt;
 ./com_compname/views/mngtable2/tmpl/default.php *&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
$pathToGeneralView = strchr(dirname(__FILE__), dirname($_SERVER[&#039;SCRIPT_NAME&#039;]));&lt;br /&gt;
$pathToGeneralView = str_replace(dirname($_SERVER[&#039;SCRIPT_NAME&#039;]),&#039;.&#039;,$pathToGeneralView );&lt;br /&gt;
$pathToGeneralView = $pathToGeneralView . &amp;quot;/../../general/&amp;quot;;  &amp;lt;-- returning path from current position. &lt;br /&gt;
...&lt;br /&gt;
&amp;lt;?php require_once $pathToGeneralView . &#039;navigation.header.php&#039;; ?&amp;gt;&lt;br /&gt;
&amp;lt;P&amp;gt;Do something    &lt;br /&gt;
&amp;lt;?php require_once $pathToGeneralView . &#039;navigation.footer.php&#039;; ?&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Another Way to do the same thing:&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
$pathToGeneralView = JPATH_COMPONENT_ADMINISTRATOR. &amp;quot;/views/general/&amp;quot;;  &amp;lt;-- will return &#039;path/Joomla/administrator/components/com_example/views/general/&#039;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;?php require_once $pathToGeneralView . &#039;navigation.header.php&#039;; ?&amp;gt;&lt;br /&gt;
&amp;lt;P&amp;gt;Do something    &lt;br /&gt;
&amp;lt;?php require_once $pathToGeneralView . &#039;navigation.footer.php&#039;; ?&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note&#039;&#039;: Giving the forms logical instead of the &#039;&#039;default&#039;&#039; naming is of course handy when having a lot of different views. Also, having that many &#039;&#039;default&#039;&#039; forms can make it difficult to determine the context. On the other hand, the view.html.php cannot be renamed, and one is always forced to look at the directory name for the view.&lt;br /&gt;
&lt;br /&gt;
=== Essential Interaction Parameters ===&lt;br /&gt;
Everything is in place:&lt;br /&gt;
* main and dedicated controllers;&lt;br /&gt;
* main and dedicated models;&lt;br /&gt;
* different views and their forms.&lt;br /&gt;
&lt;br /&gt;
Just one big question remains: &#039;&#039;&#039;How to use them&#039;&#039;&#039;!&lt;br /&gt;
&lt;br /&gt;
Three parameters are mandatory for letting Joomla! do its job:&lt;br /&gt;
* option&lt;br /&gt;
* controller&lt;br /&gt;
* task&lt;br /&gt;
&lt;br /&gt;
These three parameters are almost self explaining ;). The &#039;&#039;option&#039;&#039; part when developing a component is easy, always assign your component name to it. For component development consider this one as a constant, of course the Joomla! engine has more options than only components.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;controller&#039;&#039; and &#039;&#039;task&#039;&#039; parameters can be manipulated within your component anyway you want it to. &lt;br /&gt;
&lt;br /&gt;
==== How it all works together ====&lt;br /&gt;
Looking at the simplified MVC picture Joomla! the logical flow of interaction goes the following way:&lt;br /&gt;
# What is my entrance point? &lt;br /&gt;
#*The Joomla! engine discovers a logged in administrator and sets the entrance point to &amp;lt;root&amp;gt;/administrator/index.php otherwise it will go to the &amp;lt;root&amp;gt;/index.php entrance.&lt;br /&gt;
# What option is requested? &lt;br /&gt;
#*The Joomla! engine reads the option variable and discovers that a component named &amp;lt;componentname&amp;gt; is requested. The entrance point becomes: &amp;lt;root&amp;gt;/administrator/components/com_&amp;lt;componentname&amp;gt;/&amp;lt;componentname&amp;gt;.php&lt;br /&gt;
# Is there need to access a dedicated controller? &lt;br /&gt;
#* The Joomla! engine reads the controller variable and discovers that a dedicated controller is required: &amp;lt;root&amp;gt;/administrator/components/com_&amp;lt;componentname&amp;gt;/controllers/&amp;lt;dedicatedcontroller&amp;gt;.php&lt;br /&gt;
# Is there a task that needs to be addressed? &lt;br /&gt;
#* The identified controller is handed the task value as parameter. &lt;br /&gt;
# The Model is derived from the controller and instantiated.&lt;br /&gt;
# The View and Form are set in the controller and initiated to become active.&lt;br /&gt;
&lt;br /&gt;
=== How to add interaction ===&lt;br /&gt;
Within HTML there are two common ways to interact with Joomla!:&lt;br /&gt;
# reference to a link&lt;br /&gt;
# form submission post / get&lt;br /&gt;
&lt;br /&gt;
==== Link reference for the Joomla! engine ====&lt;br /&gt;
Remember the &#039;&#039;&#039;activating tasks&#039;&#039;&#039; and &#039;&#039;&#039;resulting tasks&#039;&#039;&#039; mentioned earlier? Most activating tasks are initiated by a link. In case of the Library example the site section overview could be copied to the admin section. This default view will now be extended and every cell will become a link for editing the specific database element.&lt;br /&gt;
&lt;br /&gt;
Using the Library example, the template PHP code without looping control will contain the following code:&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
$link = JRoute::_( &#039;index.php?option=com_library&amp;amp;controller=users&amp;amp;task=edit&amp;amp;cid=&#039;. $row-&amp;gt;idu );&lt;br /&gt;
echo &amp;quot;&amp;lt;td&amp;gt;&amp;lt;a href=\&amp;quot;&amp;quot;.$link.&amp;quot;\&amp;quot;&amp;gt;$row-&amp;gt;name&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&amp;quot;;&lt;br /&gt;
$link = JRoute::_( &#039;index.php?option=com_library&amp;amp;controller=books&amp;amp;task=edit&amp;amp;cid=&#039;. $row-&amp;gt;idb );&lt;br /&gt;
echo &amp;quot;&amp;lt;td&amp;gt;&amp;lt;a href=\&amp;quot;&amp;quot;.$link.&amp;quot;\&amp;quot;&amp;gt;$row-&amp;gt;title&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&amp;quot;;&lt;br /&gt;
$link = JRoute::_( &#039;index.php?option=com_library&amp;amp;controller=relation&amp;amp;task=edit&amp;amp;cid=&#039;. $row-&amp;gt;idr );&lt;br /&gt;
echo &amp;quot;&amp;lt;td&amp;gt;&amp;lt;a href=\&amp;quot;&amp;quot;.$link.&amp;quot;\&amp;quot;&amp;gt;$row-&amp;gt;date&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&amp;quot;;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Within each clickable field the three mandatory parameters to manipulate Joomla! can be identified. In addition there is one user parameter for handling the correct index in the controller task (cid). These parameter are separated by &#039;&amp;amp;&#039;. Do not use spaces in your variables, as this might screw-up parameter handling in certain browsers. After looping, all text entries will be clickable and trigger the corresponding controller with the correct row id in the associated table.&lt;br /&gt;
&lt;br /&gt;
 [Alice] | [One flew over ...] | [12-aug-2009]&lt;br /&gt;
 [Alice] | [Celeb talk]        | [12-aug-2009]&lt;br /&gt;
 [Mark]  | [Joomla!]           | [15-aug-2009]&lt;br /&gt;
&lt;br /&gt;
==== Posting Form Data to the Joomla! Engine ====&lt;br /&gt;
After being initiated by an activating task, an input form view might be the result. The snippet of code below could be the result of clicking the first cell of the default component view that is clicked for editing ([Alice]:cid=3). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;form action=&amp;quot;index.php&amp;quot; method=&amp;quot;post&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;input type=&amp;quot;text&amp;quot; name=&amp;quot;username&amp;quot; id=&amp;quot;username&amp;quot; size=&amp;quot;32&amp;quot; maxlength=&amp;quot;250&amp;quot; value=&amp;quot;&amp;lt;?php echo $this-&amp;gt;user-&amp;gt;name;?&amp;gt;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;SubmitButton&amp;quot; value=&amp;quot;Save&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;option&amp;quot; value=&amp;quot;com_library&amp;quot; /&amp;gt;                  // &amp;lt;-- mandatory&lt;br /&gt;
  &amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;controller&amp;quot; value=&amp;quot;hello&amp;quot; /&amp;gt;                    // &amp;lt;-- mandatory&lt;br /&gt;
  &amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;task&amp;quot; value=&amp;quot;save&amp;quot; /&amp;gt;                           // &amp;lt;-- mandatory&lt;br /&gt;
  &amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;id&amp;quot; value=&amp;quot;&amp;lt;?php echo $this-&amp;gt;user-&amp;gt;id; ?&amp;gt;&amp;quot; /&amp;gt;   // &amp;lt;-- user parameter, index in database for [Alice]&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three Joomla! mandatory parameters are placed as hidden in the form. Hidden parameters are not shown in any way but will be added to the posting data.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tip&#039;&#039;: when debugging this form, replace in the form tag &amp;lt;code&amp;gt;method=&amp;quot;post&amp;quot;&amp;lt;/code&amp;gt; temporarily with &amp;lt;code&amp;gt;method=&amp;quot;get&amp;quot;&amp;lt;/code&amp;gt;. All posted parameters will be shown in the URL of your browser. If the module is working undo this change. For one reason it looks sharper without all the parameters being shown in the URL and you avoid motivating people to manipulate the browser URL themselves. The other reason is more technical and the simple explanation is that post methods (i.e. method=&amp;quot;post&amp;quot;) can contain more (complex) data.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Remark&#039;&#039;: In some developed modules you may notice that developers have also added the &#039;&#039;view&#039;&#039; parameter. This is bad programming whilst the controller(s) should take care of the &#039;&#039;view&#039;&#039; and the &#039;&#039;form&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
The use of the three mandatory parameters and the different access points are clarified. Let&#039;s do something with this knowledge and extend the Hello component to the administrative section in the succeeding articles of this tutorial.&lt;br /&gt;
&lt;br /&gt;
== Articles in this Series ==&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 1]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 2 - Adding a Model]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 3 - Using the Database]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 4 - Creating an Administrator Interface]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 5 - Basic Backend Framework]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 6 - Adding Backend Actions]]&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
* staalanden&lt;br /&gt;
* jamesconroyuk&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Kissaki</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J1.5:Developing_a_MVC_Component/Creating_an_Administrator_Interface&amp;diff=30623</id>
		<title>J1.5:Developing a MVC Component/Creating an Administrator Interface</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J1.5:Developing_a_MVC_Component/Creating_an_Administrator_Interface&amp;diff=30623"/>
		<updated>2010-09-11T14:00:17Z</updated>

		<summary type="html">&lt;p&gt;Kissaki: /* Views */  indent&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{ambox&lt;br /&gt;
| type  = notice&lt;br /&gt;
| image = notice&lt;br /&gt;
| text  = This {{thingamabob}} has been divided into three sections, two new articles are added. Especially this page needs a review&lt;br /&gt;
&amp;lt;small&amp;gt;(August 2009)&amp;lt;/small&amp;gt;}}&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
In the first three Parts, we have developed a MVC component that retrieves its data from a table in the database. Currently, there is no way to add data to the database except to do it manually using another tool. In the next Parts of this tutorial, we will develop an administrator section for our component which will make it possible to manage the entries in the database.&lt;br /&gt;
&lt;br /&gt;
This Part, [[Developing a Model-View-Controller Component - Part 4 - Creating an Administrator Interface | Part 4 - Creating an Administrator Interface]], will be an article with no new source code for our Hello component but will describe some basic details and in-depth explanation of the MVC pattern. This intermediate chapter is not required to complete the Hello model so if you think you understand the basics continue with [[Developing a Model-View-Controller Component - Part 5 - Basic Backend Framework]].&lt;br /&gt;
&lt;br /&gt;
In the frontend solution (site section, parts 1,2 and 3) we developed the first part of our component. The frontend solution is based upon default Controllers, Views and Templates and you were &amp;quot;taken by the hand&amp;quot; and &amp;quot;left to trust&amp;quot; the default handling of the code. This is going to change in the Backend or Administration section of our Hello component ( parts 5 and 6) - we will have to develop all of the code that manages the application flow.&lt;br /&gt;
&lt;br /&gt;
== Site / Admin ==&lt;br /&gt;
Joomla! is a content management system. The &#039;&#039;&#039;frontend&#039;&#039;&#039; is used for presenting the users with content and allows certain logged in users to manipulate the content. The &#039;&#039;&#039;backend&#039;&#039;&#039; is responsible for administering the website framework (structuring / managing / controlling / maintaining). This division between (frontend) site-content and (backend) administration is a fundamental aspect of the Joomla! architecture.&lt;br /&gt;
&lt;br /&gt;
=== Entrance points ===&lt;br /&gt;
From the XML file of our frontend example it was already obvious that there would be an administration part:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;administration&amp;gt;&lt;br /&gt;
  &amp;lt;!--  Administration Menu Section --&amp;gt; &lt;br /&gt;
  &amp;lt;menu&amp;gt;Hello World!&amp;lt;/menu&amp;gt; &lt;br /&gt;
  &amp;lt;!--  Administration Main File Copy Section --&amp;gt; &lt;br /&gt;
  &amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;filename&amp;gt;hello.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;install.sql&amp;lt;/filename&amp;gt; &lt;br /&gt;
  &amp;lt;filename&amp;gt;uninstall.sql&amp;lt;/filename&amp;gt; &lt;br /&gt;
  &amp;lt;/files&amp;gt;&lt;br /&gt;
  &amp;lt;/administration&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Only the .sql files were of use and only during installation for our frontend view, the other two files have no content besides generating a blank page. Access your websites&#039; file system at your hosting provider (or on your own server) and browse through the directories after installing the frontend com_hello component. You may have noticed that our Hello component is to be found twice:&lt;br /&gt;
 &amp;lt;root&amp;gt;/components/com_hello&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/components/com_hello&lt;br /&gt;
&lt;br /&gt;
These two sub-directories link to the previously explained site-content and administration. Administrator interactions explicitly go via the administrator sub-directory, where guest or registered users will enter the default entrance on the root:&lt;br /&gt;
 &amp;lt;root&amp;gt;/index.php&lt;br /&gt;
Administrative users will have to log in, and after logging in they will enter your site via:&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/index.php&lt;br /&gt;
&lt;br /&gt;
With the different access points it is easy to grasp that with setting up the administrator section the naming conventions have no dependency with the site section. Whilst the MVC pattern is also applicable for the administrator section this implies that identical Controllers, Views and Models naming can (and sometimes must) be used as in the site section.&lt;br /&gt;
&lt;br /&gt;
== MVC pattern interaction ==&lt;br /&gt;
[[image:MVC joomla.png|frameless|right]]In [[Developing a Model-View-Controller Component - Part 1]] the figure on the right was used to explain the focus of the first three parts of this &#039;&#039;Developing a Model-View-Controller Component tutorial&#039;&#039;. Now we will use this figure to explain how decisions are made on what is going to be displayed and how to manipulate this.&lt;br /&gt;
&lt;br /&gt;
=== Example roll-out ===&lt;br /&gt;
For explanation purposes an easy to grasp example will be used. A library has the main function of lending books to registered users. Simply laid out there are three tables:&lt;br /&gt;
* users&lt;br /&gt;
* books&lt;br /&gt;
* relation&lt;br /&gt;
&lt;br /&gt;
Lets keep it all very simple. The users are addressed by Id and Name. The books are identified by Id and Title and the relation contains both Ids and the date of lending.&lt;br /&gt;
&lt;br /&gt;
[[image:Library Example.png|400px|frameless|center]]&lt;br /&gt;
&lt;br /&gt;
The example is carefully chosen and will help in explaining the Joomla! architecture in more detail. The administrative side of our Hello component is not even that complex with only one table to manage. After the explanation of this Part it should be easy to follow the tutorial in the succeeding Parts.&lt;br /&gt;
&lt;br /&gt;
=== Mapping a Joomla! MVC component from the example ===&lt;br /&gt;
In this example we will assume that administrative actions (add, edit, delete) are tasks that are to be performed by the administrator. For the frontend user only the view of the Relation table is interesting (&amp;quot;when do I have to bring back the books?&amp;quot;). This example shows the entire list and ignores all privacy stuff that could be taken care of by letting registered users only see their own books. (&#039;&#039;See&#039;&#039;: [http://api.joomla.org/Joomla-Framework/User/JUser.html JUser object] for making user deviations in template module).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Just like our frontend Hello component, for this library component only the default view is being used in the frontend. It lists the relational table, left joining the other two tables to obtain a human readable list of books with their corresponding due date. &lt;br /&gt;
 Alice | One flew over ... | 12-aug-2009&lt;br /&gt;
 Alice | Celeb talk        | 12-aug-2009&lt;br /&gt;
 Mark  | Joomla!           | 15-aug-2009&lt;br /&gt;
&lt;br /&gt;
With respect to the administration part it is important to understand that we have one default and three dedicated views, each controlling three tasks:&lt;br /&gt;
* &amp;lt;Component name default view&amp;gt;&lt;br /&gt;
* User administration&lt;br /&gt;
** Add&lt;br /&gt;
** Change&lt;br /&gt;
** Delete&lt;br /&gt;
* Book administration&lt;br /&gt;
** Add&lt;br /&gt;
** Change&lt;br /&gt;
** Delete&lt;br /&gt;
* Relation administration&lt;br /&gt;
** Add&lt;br /&gt;
** Change&lt;br /&gt;
** Delete&lt;br /&gt;
&lt;br /&gt;
==== Controllers ====&lt;br /&gt;
The main controller of the admin section needs to differentiate between the different Adds, Changes or Deletes that are requested. This is taken care of by creating sub-controllers for each view for handling their specific tasks.&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/controller.php&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/controllers/users.php&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/controllers/books.php&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/controllers/relation.php&lt;br /&gt;
&lt;br /&gt;
The controller is an important part of the MVC pattern. Not only does it take care of the requested tasks, it is also the initiator of instantiating the model with the same name and it is responsible for setting the view and the desired form for that view. The controller really justifies its name. &lt;br /&gt;
&lt;br /&gt;
Within the controller it is good to make a difference between &#039;&#039;&#039;activating tasks&#039;&#039;&#039; (for example the edit selection from a menu) and &#039;&#039;&#039;resulting tasks&#039;&#039;&#039; (for example the result of an edit trigger is the posted data).&lt;br /&gt;
&lt;br /&gt;
Typical controller functions look like:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function &amp;lt;activating task&amp;gt;()  // &amp;lt;-- edit, add, delete &lt;br /&gt;
{&lt;br /&gt;
    JRequest::setVar( &#039;view&#039;, &#039;[&amp;lt;componentname&amp;gt; | users | books | relation ]&#039; );&lt;br /&gt;
    JRequest::setVar( &#039;layout&#039;, &#039;default&#039;  );     // &amp;lt;-- The default form is named here, but in&lt;br /&gt;
                                                  // some complex views, multiple layouts might&lt;br /&gt;
                                                  // be needed.&lt;br /&gt;
    parent::display();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function &amp;lt;resulting task&amp;gt;()  // &amp;lt;-- save, remove&lt;br /&gt;
{&lt;br /&gt;
	$model = $this-&amp;gt;getModel(&#039;[&amp;lt;componentname&amp;gt; | users | books | relation ]&#039;);&lt;br /&gt;
	if(!$model-&amp;gt;action() ) {    // &amp;lt;-- action could be delete() or store()&lt;br /&gt;
		$msg = JText::_( &#039;Error: Could not perform action&#039; );&lt;br /&gt;
	} else {&lt;br /&gt;
		$msg = JText::_( &#039;Action executed&#039; );&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	$this-&amp;gt;setRedirect( &#039;index.php?option=&amp;lt;componentname&amp;gt;&#039;, $msg );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
A controller takes care of all tasks for that dedicated controller. After completing a resulting task the module will return to the main administration entrance point for that component, the main controller with the default view. Activating tasks enforce a new view with a form to display after first defining it.&lt;br /&gt;
&lt;br /&gt;
The explicit definition of the form within a view might raise some eyebrows but our examples are too simple. For the general understanding and consistency this field should mostly be &#039;&#039;default&#039;&#039;. In complex views multiple forms could be defined within one view.&lt;br /&gt;
&lt;br /&gt;
==== Models ====&lt;br /&gt;
The Controllers interact with their equally named Model counter part. In the frontend view the Model was only used to retrieve data. The backend has more controllers and thus also more model files. The backend model files not only are responsible for delivering data to the viewer but also take care of tasks initiated from the controller. A good model contains all actions required to manage a single table in the database.&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/models/&amp;lt;componentname&amp;gt;.php&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/models/users.php&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/models/books.php&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/models/relation.php&lt;br /&gt;
&lt;br /&gt;
==== Views ====&lt;br /&gt;
Separate views are of course also required. For views and subsequent forms no forced naming conventions are required (linking to views is taken care of in the controller). In the following listing the Administrative tasks are identified as a subset for the different views. This choice is totally random and maybe even non-logical but that doesn&#039;t matter for the explanation. Just for example purposes I added also a different view, a delete view, that could be used for all the deletes for all administrative tasks asking an &amp;quot;Are you sure&amp;quot; display.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/views/&amp;lt;componentname&amp;gt;/view.html.php + .../tmpl/default.php&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/views/users/view.html.php           + .../tmpl/default.php&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/views/books/view.html.php           + .../tmpl/default.php&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/views/relation/view.html.php        + .../tmpl/default.php&lt;br /&gt;
 &amp;lt;root&amp;gt;/administrator/views/delete/view.html.php          + .../tmpl/default.php&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note&#039;&#039;: In general it is good practice to maintain one form per view because the view.html.php still has to deliver the content. With some basic logic you can enable, disable certain content but if this logic is becoming too complex start considering splitting up the view. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note&#039;&#039;: Sharing template parts amongst the different views (for uniform layouting of headers and titles of your component) can be done using the PHP &amp;lt;code&amp;gt;include / require;&amp;lt;/code&amp;gt;. There is one slight problem ... how to make the logical reference? In my modules I have a collector bin for general to use sniplets. Because it involved the views and forms I put this general bin in the views directory. The variable $pathToGeneralView needs to be defined somewhere in the first lines of your file and you have to make sure that the logical reference path is correct (the &#039;..&#039;s). In the following example the files marked with a &#039;*&#039; use the following code:&lt;br /&gt;
&lt;br /&gt;
 ./com_compname/views/general/navigate.header.php  &amp;lt;-- sniplet code for the header&lt;br /&gt;
 ./com_compname/views/general/navigate.footer.php  &amp;lt;-- sniplet code for the footer&lt;br /&gt;
 ./com_compname/views/mngtable1/view.html.php&lt;br /&gt;
 ./com_compname/views/mngtable1/tmpl/default.php *&lt;br /&gt;
 ./com_compname/views/mngtable2/view.html.php&lt;br /&gt;
 ./com_compname/views/mngtable2/tmpl/default.php *&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
$pathToGeneralView = strchr(dirname(__FILE__), dirname($_SERVER[&#039;SCRIPT_NAME&#039;]));&lt;br /&gt;
$pathToGeneralView = str_replace(dirname($_SERVER[&#039;SCRIPT_NAME&#039;]),&#039;.&#039;,$pathToGeneralView );&lt;br /&gt;
$pathToGeneralView = $pathToGeneralView . &amp;quot;/../../general/&amp;quot;;  &amp;lt;-- returning path from current position. &lt;br /&gt;
...&lt;br /&gt;
&amp;lt;?php require_once $pathToGeneralView . &#039;navigation.header.php&#039;; ?&amp;gt;&lt;br /&gt;
&amp;lt;P&amp;gt;Do something    &lt;br /&gt;
&amp;lt;?php require_once $pathToGeneralView . &#039;navigation.footer.php&#039;; ?&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Another Way to do the same thing:&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
$pathToGeneralView = JPATH_COMPONENT_ADMINISTRATOR. &amp;quot;/views/general/&amp;quot;;  &amp;lt;-- will return &#039;path/Joomla/administrator/components/com_example/views/general/&#039;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;?php require_once $pathToGeneralView . &#039;navigation.header.php&#039;; ?&amp;gt;&lt;br /&gt;
&amp;lt;P&amp;gt;Do something    &lt;br /&gt;
&amp;lt;?php require_once $pathToGeneralView . &#039;navigation.footer.php&#039;; ?&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note&#039;&#039;: Giving the forms logical instead of the &#039;&#039;default&#039;&#039; naming is of course handy when having a lot of different views. Also, having that many &#039;&#039;default&#039;&#039; forms can make it difficult to determine the context. On the other hand, the view.html.php cannot be renamed, and one is always forced to look at the directory name for the view.&lt;br /&gt;
&lt;br /&gt;
=== Essential Interaction Parameters ===&lt;br /&gt;
Everything is in place:&lt;br /&gt;
* main and dedicated controllers;&lt;br /&gt;
* main and dedicated models;&lt;br /&gt;
* different views and their forms.&lt;br /&gt;
&lt;br /&gt;
Just one big question remains: &#039;&#039;&#039;How to use them&#039;&#039;&#039;!&lt;br /&gt;
&lt;br /&gt;
Three parameters are mandatory for letting Joomla! do its job:&lt;br /&gt;
* option&lt;br /&gt;
* controller&lt;br /&gt;
* task&lt;br /&gt;
&lt;br /&gt;
These three parameters are almost self explaining ;). The &#039;&#039;option&#039;&#039; part when developing a component is easy, always assign your component name to it. For component development consider this one as a constant, of course the Joomla! engine has more options than only components.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;controller&#039;&#039; and &#039;&#039;task&#039;&#039; parameters can be manipulated within your component anyway you want it to. &lt;br /&gt;
&lt;br /&gt;
==== How it all works together ====&lt;br /&gt;
Looking at the simplified MVC picture Joomla! the logical flow of interaction goes the following way:&lt;br /&gt;
# What is my entrance point? &lt;br /&gt;
#*The Joomla! engine discovers a logged in administrator and sets the entrance point to &amp;lt;root&amp;gt;/administrator/index.php otherwise it will go to the &amp;lt;root&amp;gt;/index.php entrance.&lt;br /&gt;
# What option is requested? &lt;br /&gt;
#*The Joomla! engine reads the option variable and discovers that a component named &amp;lt;componentname&amp;gt; is requested. The entrance point becomes: &amp;lt;root&amp;gt;/administrator/components/com_&amp;lt;componentname&amp;gt;/&amp;lt;componentname&amp;gt;.php&lt;br /&gt;
# Is there need to access a dedicated controller? &lt;br /&gt;
#* The Joomla! engine reads the controller variable and discovers that a dedicated controller is required: &amp;lt;root&amp;gt;/administrator/components/com_&amp;lt;componentname&amp;gt;/controllers/&amp;lt;dedicatedcontroller&amp;gt;.php&lt;br /&gt;
# Is there a task that needs to be addressed? &lt;br /&gt;
#* The identified controller is handed the task value as parameter. &lt;br /&gt;
# The Model is derived from the controller and instantiated.&lt;br /&gt;
# The View and Form are set in the controller and initiated to become active.&lt;br /&gt;
&lt;br /&gt;
=== How to add interaction ===&lt;br /&gt;
Within HTML there are two common ways to interact with Joomla!:&lt;br /&gt;
# reference to a link&lt;br /&gt;
# form submission post / get&lt;br /&gt;
&lt;br /&gt;
==== Link reference for the Joomla! engine ====&lt;br /&gt;
Remember the &#039;&#039;&#039;activating tasks&#039;&#039;&#039; and &#039;&#039;&#039;resulting tasks&#039;&#039;&#039; mentioned earlier? Most activating tasks are initiated by a link. In case of the Library example the site section overview could be copied to the admin section. This default view will now be extended and every cell will become a link for editing the specific database element.&lt;br /&gt;
&lt;br /&gt;
Using the Library example, the template PHP code without looping control will contain the following code:&lt;br /&gt;
&amp;lt;source lang=php&amp;gt;&lt;br /&gt;
$link = JRoute::_( &#039;index.php?option=com_library&amp;amp;controller=users&amp;amp;task=edit&amp;amp;cid=&#039;. $row-&amp;gt;idu );&lt;br /&gt;
echo &amp;quot;&amp;lt;td&amp;gt;&amp;lt;a href=\&amp;quot;&amp;quot;.$link.&amp;quot;\&amp;quot;&amp;gt;$row-&amp;gt;name&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&amp;quot;;&lt;br /&gt;
$link = JRoute::_( &#039;index.php?option=com_library&amp;amp;controller=books&amp;amp;task=edit&amp;amp;cid=&#039;. $row-&amp;gt;idb );&lt;br /&gt;
echo &amp;quot;&amp;lt;td&amp;gt;&amp;lt;a href=\&amp;quot;&amp;quot;.$link.&amp;quot;\&amp;quot;&amp;gt;$row-&amp;gt;title&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&amp;quot;;&lt;br /&gt;
$link = JRoute::_( &#039;index.php?option=com_library&amp;amp;controller=relation&amp;amp;task=edit&amp;amp;cid=&#039;. $row-&amp;gt;idr );&lt;br /&gt;
echo &amp;quot;&amp;lt;td&amp;gt;&amp;lt;a href=\&amp;quot;&amp;quot;.$link.&amp;quot;\&amp;quot;&amp;gt;$row-&amp;gt;date&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&amp;quot;;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Within each clickable field the three mandatory parameters to manipulate Joomla! can be identified. In addition there is one user parameter for handling the correct index in the controller task (cid). These parameter are separated by &#039;&amp;amp;&#039;. Do not use spaces in your variables, as this might screw-up parameter handling in certain browsers. After looping, all text entries will be clickable and trigger the corresponding controller with the correct row id in the associated table.&lt;br /&gt;
&lt;br /&gt;
 [Alice] | [One flew over ...] | [12-aug-2009]&lt;br /&gt;
 [Alice] | [Celeb talk]        | [12-aug-2009]&lt;br /&gt;
 [Mark]  | [Joomla!]           | [15-aug-2009]&lt;br /&gt;
&lt;br /&gt;
==== Posting Form Data to the Joomla! Engine ====&lt;br /&gt;
After being initiated by an activating task, an input form view might be the result. The snippet of code below could be the result of clicking the first cell of the default component view that is clicked for editing ([Alice]:cid=3). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;form action=&amp;quot;index.php&amp;quot; method=&amp;quot;post&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;input type=&amp;quot;text&amp;quot; name=&amp;quot;username&amp;quot; id=&amp;quot;username&amp;quot; size=&amp;quot;32&amp;quot; maxlength=&amp;quot;250&amp;quot; value=&amp;quot;&amp;lt;?php echo $this-&amp;gt;user-&amp;gt;name;?&amp;gt;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;SubmitButton&amp;quot; value=&amp;quot;Save&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;option&amp;quot; value=&amp;quot;com_library&amp;quot; /&amp;gt;                  // &amp;lt;-- mandatory&lt;br /&gt;
  &amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;controller&amp;quot; value=&amp;quot;hello&amp;quot; /&amp;gt;                    // &amp;lt;-- mandatory&lt;br /&gt;
  &amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;task&amp;quot; value=&amp;quot;save&amp;quot; /&amp;gt;                           // &amp;lt;-- mandatory&lt;br /&gt;
  &amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;id&amp;quot; value=&amp;quot;&amp;lt;?php echo $this-&amp;gt;user-&amp;gt;id; ?&amp;gt;&amp;quot; /&amp;gt;   // &amp;lt;-- user parameter, index in database for [Alice]&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three Joomla! mandatory parameters are placed as hidden in the form. Hidden parameters are not shown in any way but will be added to the posting data.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tip&#039;&#039;: when debugging this form, replace in the form tag &amp;lt;code&amp;gt;method=&amp;quot;post&amp;quot;&amp;lt;/code&amp;gt; temporarily with &amp;lt;code&amp;gt;method=&amp;quot;get&amp;quot;&amp;lt;/code&amp;gt;. All posted parameters will be shown in the URL of your browser. If the module is working undo this change. For one reason it looks sharper without all the parameters being shown in the URL and you avoid motivating people to manipulate the browser URL themselves. Of course one can look at the source code but using &#039;&#039;Post&#039;&#039; instead of &#039;&#039;Get&#039;&#039;, but this eliminates the first 90% of the earth population. The other reason is more technical and the simple explanation is that post methods (i.e. method=&amp;quot;post&amp;quot;) can contain more (complex) data.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Remark&#039;&#039;: In some developed modules you may notice that developers have also added the &#039;&#039;view&#039;&#039; parameter. This is bad programming whilst the controller(s) should take care of the &#039;&#039;view&#039;&#039; and the &#039;&#039;form&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
The use of the three mandatory parameters and the different access points are clarified. Let&#039;s do something with this knowledge and extend the Hello component to the administrative section in the succeeding articles of this tutorial.&lt;br /&gt;
&lt;br /&gt;
== Articles in this Series ==&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 1]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 2 - Adding a Model]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 3 - Using the Database]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 4 - Creating an Administrator Interface]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 5 - Basic Backend Framework]]&lt;br /&gt;
&lt;br /&gt;
[[Developing a Model-View-Controller Component - Part 6 - Adding Backend Actions]]&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
* staalanden&lt;br /&gt;
* jamesconroyuk&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Kissaki</name></author>
	</entry>
</feed>