<?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=Burek</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=Burek"/>
	<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/Special:Contributions/Burek"/>
	<updated>2026-09-07T04:25:49Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Packaging_a_extension&amp;diff=101227</id>
		<title>Packaging a extension</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Packaging_a_extension&amp;diff=101227"/>
		<updated>2013-06-30T07:04:32Z</updated>

		<summary type="html">&lt;p&gt;Burek: added a proper link for AppleDouble on Wikipedia&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A directory with several loose files is not a convenient package for distribution. So the final step is to make a &#039;&#039;package&#039;&#039;. This is a compressed archive containing the directory structure and all the files. The package can be in &#039;&#039;&#039;ZIP&#039;&#039;&#039; format (with a &amp;lt;tt&amp;gt;.zip&amp;lt;/tt&amp;gt; extension), in &#039;&#039;&#039;TAR-gzip&#039;&#039;&#039; format (with a &amp;lt;tt&amp;gt;.tar.gz&amp;lt;/tt&amp;gt; extension), or in &#039;&#039;&#039;TAR-bz2&#039;&#039;&#039; format (with a &amp;lt;tt&amp;gt;.tar.bz2&amp;lt;/tt&amp;gt; extension). &lt;br /&gt;
&lt;br /&gt;
If your template is in a directory &amp;lt;tt&amp;gt;mytemplate/&amp;lt;/tt&amp;gt; then to make the package you can connect to that directory and use commands like:&lt;br /&gt;
* &amp;lt;tt&amp;gt;tar cvvzf ../mytemplate.tar.gz *&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;zip -a -r ..\mytemplate.zip *.*&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Note to Mac OS X users ===&lt;br /&gt;
Note to template developers using Mac OS X systems: the Finder&#039;s &amp;quot;compress&amp;quot; menu item produces a usable ZIP format package, but with one catch. It stores the files in [[AppleDouble]] format, adding extra files with names beginning with &amp;quot;&amp;lt;tt&amp;gt;._&amp;lt;/tt&amp;gt;&amp;quot;. Thus it adds a file named &amp;quot;&amp;lt;tt&amp;gt;._templateDetails.xml&amp;lt;/tt&amp;gt;, which Joomla 1.5.x can sometimes misinterpret. The symptom is an error message, &amp;quot;XML Parsing Error at 1:1. Error 4: Empty document&amp;quot;. The workaround is to compress from the command line, and set a shell environment variable &amp;quot;COPYFILE_DISABLE&amp;quot; to &amp;quot;true&amp;quot; before using &amp;quot;compress&amp;quot; or &amp;quot;tar&amp;quot;. See the [http://en.wikipedia.org/wiki/AppleSingle_and_AppleDouble_formats AppleDouble] article for more information.&lt;br /&gt;
&lt;br /&gt;
To set an environment variable on a Mac, open a terminal window and type:&lt;br /&gt;
 export COPYFILE_DISABLE=true&lt;br /&gt;
&lt;br /&gt;
Then in the same terminal window, change directories into where your template files reside and issue the zip command.  For instance, if your template files have been built in a folder in your personal directory called myTemplate, then you would do the following:&lt;br /&gt;
 cd myTemplate&lt;br /&gt;
 zip -r myTemplate.zip *&lt;br /&gt;
&lt;br /&gt;
[[Category:Extension development]]&lt;/div&gt;</summary>
		<author><name>Burek</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J1.5:Plugin/Events/User&amp;diff=76948</id>
		<title>J1.5:Plugin/Events/User</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J1.5:Plugin/Events/User&amp;diff=76948"/>
		<updated>2012-10-24T14:30:09Z</updated>

		<summary type="html">&lt;p&gt;Burek: moved TOC to the right for more convenient page display&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{RightTOC}}&lt;br /&gt;
&lt;br /&gt;
In a standard installation of Joomla! 1.5 we have several predefined events which, when triggered, call functions in the associated plugins.&lt;br /&gt;
&lt;br /&gt;
The user events are divided into two parts. First we have the events used while &lt;br /&gt;
authentication of a user takes place:&lt;br /&gt;
*onLoginUser&lt;br /&gt;
*onLogoutUser&lt;br /&gt;
*onAuthenticate&lt;br /&gt;
*onAuthenticateFailure&lt;br /&gt;
  &lt;br /&gt;
Second we have the events triggered during user management:&lt;br /&gt;
*onBeforeStoreUser&lt;br /&gt;
*onAfterStoreUser&lt;br /&gt;
*onBeforeDeleteUser&lt;br /&gt;
*onAfterDeleteUser&lt;br /&gt;
&lt;br /&gt;
==onLoginUser==&lt;br /&gt;
===Description===&lt;br /&gt;
This event is triggered after the user is authenticated against the Joomla! user-base.&lt;br /&gt;
&lt;br /&gt;
If you need to abort the login process (authentication), you will need to use [http://docs.joomla.org/Reference:User_Events_for_Plugin_System#5.3.4_onAuthenticate onAuthenticate] instead.&lt;br /&gt;
&lt;br /&gt;
===Parameters===&lt;br /&gt;
* $user - an associative array of [http://api.joomla.org/Joomla-Framework/User/JAuthenticationResponse.html JAuthenticateResponse] type (see link for array keys)&lt;br /&gt;
* $options - an associative array containing these keys: [&amp;quot;remember&amp;quot;] =&amp;gt; bool, [&amp;quot;return&amp;quot;] =&amp;gt; string, [&amp;quot;entry_url&amp;quot;] =&amp;gt; string&lt;br /&gt;
&lt;br /&gt;
===Return Value===&lt;br /&gt;
Boolean&lt;br /&gt;
===Used in files===&lt;br /&gt;
*&amp;lt;tt&amp;gt;libraries/joomla/application/application.php&amp;lt;/tt&amp;gt;&lt;br /&gt;
*&amp;lt;tt&amp;gt;plugins/user/joomla.php&amp;lt;/tt&amp;gt;&lt;br /&gt;
===Examples===&lt;br /&gt;
*&amp;lt;tt&amp;gt;plugins/user/example.php&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==onLogoutUser==&lt;br /&gt;
===Description===&lt;br /&gt;
This event is triggered before the user is logged out of the system. &amp;lt;del&amp;gt;If one plugin&lt;br /&gt;
returns false, the global logout fails.&amp;lt;/del&amp;gt; (needs verification)&lt;br /&gt;
&lt;br /&gt;
===Parameters===&lt;br /&gt;
* $credentials - an associative array containing these keys: [&amp;quot;username&amp;quot;] =&amp;gt; string, [&amp;quot;id&amp;quot;] =&amp;gt; int&lt;br /&gt;
* $options - an associative array containing this key: [&amp;quot;clientid&amp;quot;] =&amp;gt; int&lt;br /&gt;
&lt;br /&gt;
===Return Value===&lt;br /&gt;
Boolean&lt;br /&gt;
===Used in files===&lt;br /&gt;
*&amp;lt;tt&amp;gt;libraries/joomla/application/application.php&amp;lt;/tt&amp;gt;&lt;br /&gt;
*&amp;lt;tt&amp;gt;plugins/user/joomla.php&amp;lt;/tt&amp;gt;&lt;br /&gt;
===Examples===&lt;br /&gt;
*&amp;lt;tt&amp;gt;plugins/user/example.php&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==onAuthenticate==&lt;br /&gt;
===Description===&lt;br /&gt;
This event is triggered to verify that a set of login credentials is valid.&lt;br /&gt;
===Parameters===&lt;br /&gt;
Array of credentials. Structure:\\&lt;br /&gt;
[&#039;username&#039;]\\&lt;br /&gt;
[&#039;password&#039;]\\&lt;br /&gt;
Alternative authentication mechanisms can supply additional credentials.&lt;br /&gt;
&lt;br /&gt;
===Return Value===&lt;br /&gt;
An array of [[references:joomla.framework:user:jauthenticateresponse|JAuthenticateResponse]] objects detailing the results of each called plugin, including success or failure.&lt;br /&gt;
===Used in files===&lt;br /&gt;
*&amp;lt;tt&amp;gt;libraries/joomla/application/user/authentication.php&amp;lt;/tt&amp;gt;&lt;br /&gt;
*&amp;lt;tt&amp;gt;plugins/authentication/gmail.php&amp;lt;/tt&amp;gt;&lt;br /&gt;
*&amp;lt;tt&amp;gt;plugins/authentication/joomla.php&amp;lt;/tt&amp;gt;&lt;br /&gt;
*&amp;lt;tt&amp;gt;plugins/authentication/ldap.php&amp;lt;/tt&amp;gt;&lt;br /&gt;
===Examples===&lt;br /&gt;
*&amp;lt;tt&amp;gt;plugins/authentication/example.php&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==onLoginFailure==&lt;br /&gt;
===Description===&lt;br /&gt;
This event is triggered whenever a user authentication request is failed by any plugin.&lt;br /&gt;
===Parameters===&lt;br /&gt;
Two parameters. The credentials array for the user (see onAuthenticate), and the&lt;br /&gt;
[[references:joomla.framework:user:jauthenticateresponse|JAuthenticateResponse]] that caused the failure.&lt;br /&gt;
===Return Value===&lt;br /&gt;
Unknown. The return value appears to be ignored in any case.&lt;br /&gt;
===Used in files===&lt;br /&gt;
*&amp;lt;tt&amp;gt;libraries/joomla/application/user/authentication.php&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==onBeforeStoreUser==&lt;br /&gt;
===Description===&lt;br /&gt;
This event is triggered before an update of a user record.&lt;br /&gt;
&lt;br /&gt;
Password in $user array is already hashed at this point. You may retrieve the cleartext password using $_POST[&#039;password&#039;].&lt;br /&gt;
&lt;br /&gt;
===Parameters===&lt;br /&gt;
* $user - An associative array of the columns in the user table (current values).&lt;br /&gt;
* $isnew - Boolean to identify if this is a new user (true - insert) or an existing one (false - update)&lt;br /&gt;
Note; You can retrieve the values that are about to get updated with JFactory::getUser();&lt;br /&gt;
&lt;br /&gt;
===Return Value===&lt;br /&gt;
None&lt;br /&gt;
===Used in files===&lt;br /&gt;
*&amp;lt;tt&amp;gt;libraries/joomla/user/user.php&amp;lt;/tt&amp;gt;&lt;br /&gt;
===Examples===&lt;br /&gt;
*&amp;lt;tt&amp;gt;plugins/user/example.php&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==onAfterStoreUser==&lt;br /&gt;
===Description===&lt;br /&gt;
This event is triggered after an update of a user record, or when a new user has been stored in the database.&lt;br /&gt;
&lt;br /&gt;
Password in $user array is already hashed at this point. You may retrieve the cleartext password using $_POST[&#039;password&#039;].&lt;br /&gt;
&lt;br /&gt;
===Parameters===&lt;br /&gt;
* &#039;&#039;&#039;$user&#039;&#039;&#039; - An associative array of the columns in the user table.&lt;br /&gt;
* &#039;&#039;&#039;$isnew&#039;&#039;&#039; - Boolean to identify if this is a new user (true - insert) or an existing one (false - update)&lt;br /&gt;
* &#039;&#039;&#039;$success&#039;&#039;&#039; - Boolean to identify if the store was successful&lt;br /&gt;
* &#039;&#039;&#039;$msg&#039;&#039;&#039; - Error message if store failed&lt;br /&gt;
Note: The old values that were just updated are not available here or afterwards. In case you need the old values, use onBeforeStoreUser().&lt;br /&gt;
&lt;br /&gt;
===Return Value===&lt;br /&gt;
None&lt;br /&gt;
===Used in files===&lt;br /&gt;
*&amp;lt;tt&amp;gt;libraries/joomla/user/user.php&amp;lt;/tt&amp;gt;&lt;br /&gt;
===Examples===&lt;br /&gt;
*&amp;lt;tt&amp;gt;plugins/user/example.php&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==onBeforeDeleteUser==&lt;br /&gt;
===Description===&lt;br /&gt;
The event is triggered when a user is about to be deleted from the system.&lt;br /&gt;
===Parameters===&lt;br /&gt;
* $user - An associative array of the columns in the user table.&lt;br /&gt;
&lt;br /&gt;
===Return Value===&lt;br /&gt;
None.&lt;br /&gt;
===Used in files===&lt;br /&gt;
*&amp;lt;tt&amp;gt;libraries/joomla/user/user.php&amp;lt;/tt&amp;gt;&lt;br /&gt;
*&amp;lt;tt&amp;gt;plugins/user/joomla.php&amp;lt;/tt&amp;gt;&lt;br /&gt;
===Examples===&lt;br /&gt;
*&amp;lt;tt&amp;gt;plugins/user/example.php&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==onAfterDeleteUser==&lt;br /&gt;
===Description===&lt;br /&gt;
The event is triggered after a user has been deleted from the system.&lt;br /&gt;
===Parameters===&lt;br /&gt;
* $user - An associative array of the columns in the user table.&lt;br /&gt;
* $succes - Boolean to identify if the deletion was successful&lt;br /&gt;
* $msg - Error message if delete failed ([http://api.joomla.org/Joomla-Framework/Error/JError.html JError] object detailing the error, if any)&lt;br /&gt;
&lt;br /&gt;
===Return Value===&lt;br /&gt;
None.&lt;br /&gt;
===Used in files===&lt;br /&gt;
*&amp;lt;tt&amp;gt;libraries/joomla/user/user.php&amp;lt;/tt&amp;gt;&lt;br /&gt;
*&amp;lt;tt&amp;gt;plugins/user/joomla.php&amp;lt;/tt&amp;gt;&lt;br /&gt;
===Examples===&lt;br /&gt;
*&amp;lt;tt&amp;gt;plugins/user/example.php&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;[[Category:Plugin Development]][[Category:Specifications]]&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Burek</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived_talk:Developing_a_MVC_Component/Developing_a_Basic_Component&amp;diff=67260</id>
		<title>Archived talk:Developing a MVC Component/Developing a Basic Component</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived_talk:Developing_a_MVC_Component/Developing_a_Basic_Component&amp;diff=67260"/>
		<updated>2012-05-17T22:46:01Z</updated>

		<summary type="html">&lt;p&gt;Burek: /* Component name in manifestfile has to be conform */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Component name in manifestfile has to be conform ==&lt;br /&gt;
&lt;br /&gt;
In Joomla 1.6 the component name specified in the manifest file has to follow the pattern &#039;com_componentname&#039;. So here it should be &lt;br /&gt;
&lt;br /&gt;
&amp;lt;name&amp;gt;com_helloworld&amp;lt;/name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will matter at least in the menu manager, where I discovered this problem.&lt;br /&gt;
&lt;br /&gt;
== Archive is created for version 1.6 instead of 2.5 ==&lt;br /&gt;
&lt;br /&gt;
In the section &amp;quot;&#039;&#039;Packaging an installation zip file&#039;&#039;&amp;quot;, archive file offered as an example (located here: http://joomlacode.org/gf/download/frsrelease/11394/58225/com_helloworld-1.6-part01.zip) contains an XML file which has a line:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&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;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
instead of&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;2.5.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
which should be fixed, I guess.&lt;/div&gt;</summary>
		<author><name>Burek</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J1.5:Developing_a_MVC_Component/Adding_a_Model&amp;diff=64817</id>
		<title>J1.5:Developing a MVC Component/Adding a Model</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J1.5:Developing_a_MVC_Component/Adding_a_Model&amp;diff=64817"/>
		<updated>2012-02-08T06:01:28Z</updated>

		<summary type="html">&lt;p&gt;Burek: /* Using the Model */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
In the first tutorial of this series, creating a simple view-controller component using the Joomla! 1.5 CMS framework was demonstrated.&lt;br /&gt;
&lt;br /&gt;
In the first tutorial, the greeting was hardcoded into the view. This doesn&#039;t follow the MVC pattern exactly because the view is intended to only display the data, and not contain it.&lt;br /&gt;
&lt;br /&gt;
In this second part of the tutorial we will demonstrate how to move this out of the view and into a model. In future tutorials we will demonstrate the power and flexibility that this design pattern provides.&lt;br /&gt;
&lt;br /&gt;
== Creating the Model ==&lt;br /&gt;
&lt;br /&gt;
The concept of model gets its name because this class is intended to represent (or &#039;model&#039;) some entity. In our case, our first model will represent a &#039;hello&#039;, or a greeting. This is in line with our design thus far, because we have one view (&#039;hello&#039;), which is a view of our greeting.&lt;br /&gt;
&lt;br /&gt;
The naming convention for models in the Joomla! framework is that the class name starts with the name of the component (in our case &#039;hello&#039;), followed by &#039;model&#039;, followed by the model name. Therefore, our model class is called HelloModelHello.&lt;br /&gt;
&lt;br /&gt;
At this point, we will only model one behaviour of our hello, and that is retrieving the greeting. We will thus have one method, called getGreeting(). It will simply return the string &#039;Hello, World!&#039;.&lt;br /&gt;
&lt;br /&gt;
The code for the model at site/models/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;
 * Hello 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_2&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;
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 HelloModelHello extends JModel&lt;br /&gt;
{&lt;br /&gt;
    /**&lt;br /&gt;
    * Gets the greeting&lt;br /&gt;
    * @return string The greeting to be displayed to the user&lt;br /&gt;
    */&lt;br /&gt;
    function getGreeting()&lt;br /&gt;
    {&lt;br /&gt;
        return &#039;Hello, World!&#039;;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice a line that starts with jimport. The jimport function is used to load files from the Joomla! framework that are required for our component. This particular statement will load the file /libraries/joomla/application/component/model.php. The &#039;.&#039;s are used as directory separators and the last part is the name of the file to load. All files are loaded relative to the libraries directory. This particular file contains the class definition for the JModel class, which is necessary because our model extends this class.&lt;br /&gt;
&lt;br /&gt;
Now that we have created our model, we must modify our view so that it uses it to obtain the greeting.&lt;br /&gt;
&lt;br /&gt;
== Using the Model ==&lt;br /&gt;
&lt;br /&gt;
The Joomla! framework is setup in such a way that the controller will automatically load the model that has the same name as the view and will push it into the view. Since our view is called &#039;Hello&#039;, our &#039;Hello&#039; model will automatically be loaded and pushed into the view. Therefore, we can easily retrieve a reference to our model using the JView::getModel() method. (If the model had not followed this convention, we could have passed the model name, as a parameter, to [http://api.joomla.org/Joomla-Framework/Application/JView.html#getModel JView::getModel()])&lt;br /&gt;
&lt;br /&gt;
Our previous view code contained the lines:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;$greeting = &amp;quot;Hello World!&amp;quot;;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To take advantage of our model, we change this line to:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;$model = &amp;amp;$this-&amp;gt;getModel();&lt;br /&gt;
$greeting = $model-&amp;gt;getGreeting();&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The complete view now 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;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_2&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;
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;
 * @package    HelloWorld&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
class HelloViewHello extends JView&lt;br /&gt;
{&lt;br /&gt;
    function display($tpl = null)&lt;br /&gt;
    {&lt;br /&gt;
        $model = &amp;amp;$this-&amp;gt;getModel();&lt;br /&gt;
        $greeting = $model-&amp;gt;getGreeting();&lt;br /&gt;
        $this-&amp;gt;assignRef( &#039;greeting&#039;,	$greeting );&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;
=== Adding the File to the Package ===&lt;br /&gt;
&lt;br /&gt;
All that remains is to add an entry to the XML file so that our new model will be copied. The Joomla! framework will look for our model in the models directory, so the entry for this file will look like (it should be added to the site section):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;filename&amp;gt;models/hello.php&amp;lt;/filename&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Our new hello.xml file will look like:&lt;br /&gt;
 &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;
&amp;lt;install type=&amp;quot;component&amp;quot; version=&amp;quot;1.5.0&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;name&amp;gt;Hello&amp;lt;/name&amp;gt;&lt;br /&gt;
 &amp;lt;!-- The following elements are optional and free of formatting constraints --&amp;gt;&lt;br /&gt;
 &amp;lt;creationDate&amp;gt;2007-02-22&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;1.01&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 component ...&amp;lt;/description&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;controller.php&amp;lt;/filename&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;models/hello.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
  &amp;lt;filename&amp;gt;models/index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
  &amp;lt;filename&amp;gt;views/index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
  &amp;lt;filename&amp;gt;views/hello/index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
  &amp;lt;filename&amp;gt;views/hello/view.html.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
  &amp;lt;filename&amp;gt;views/hello/tmpl/default.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
  &amp;lt;filename&amp;gt;views/hello/tmpl/index.html&amp;lt;/filename&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;
&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;/files&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/install&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
We now have a simple MVC component. Each element is very simple at this point, but provides a great deal of flexibility and power.&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;
&lt;br /&gt;
== Download ==&lt;br /&gt;
&lt;br /&gt;
The component can be downloaded at: [http://joomlacode.org/gf/download/frsrelease/8109/29434/com_hello2_01.zip com_hello2_01]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Burek</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J1.5:Developing_a_MVC_Component/Adding_a_Model&amp;diff=64816</id>
		<title>J1.5:Developing a MVC Component/Adding a Model</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J1.5:Developing_a_MVC_Component/Adding_a_Model&amp;diff=64816"/>
		<updated>2012-02-08T05:57:44Z</updated>

		<summary type="html">&lt;p&gt;Burek: /* Creating the Model */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
In the first tutorial of this series, creating a simple view-controller component using the Joomla! 1.5 CMS framework was demonstrated.&lt;br /&gt;
&lt;br /&gt;
In the first tutorial, the greeting was hardcoded into the view. This doesn&#039;t follow the MVC pattern exactly because the view is intended to only display the data, and not contain it.&lt;br /&gt;
&lt;br /&gt;
In this second part of the tutorial we will demonstrate how to move this out of the view and into a model. In future tutorials we will demonstrate the power and flexibility that this design pattern provides.&lt;br /&gt;
&lt;br /&gt;
== Creating the Model ==&lt;br /&gt;
&lt;br /&gt;
The concept of model gets its name because this class is intended to represent (or &#039;model&#039;) some entity. In our case, our first model will represent a &#039;hello&#039;, or a greeting. This is in line with our design thus far, because we have one view (&#039;hello&#039;), which is a view of our greeting.&lt;br /&gt;
&lt;br /&gt;
The naming convention for models in the Joomla! framework is that the class name starts with the name of the component (in our case &#039;hello&#039;), followed by &#039;model&#039;, followed by the model name. Therefore, our model class is called HelloModelHello.&lt;br /&gt;
&lt;br /&gt;
At this point, we will only model one behaviour of our hello, and that is retrieving the greeting. We will thus have one method, called getGreeting(). It will simply return the string &#039;Hello, World!&#039;.&lt;br /&gt;
&lt;br /&gt;
The code for the model at site/models/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;
 * Hello 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_2&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;
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 HelloModelHello extends JModel&lt;br /&gt;
{&lt;br /&gt;
    /**&lt;br /&gt;
    * Gets the greeting&lt;br /&gt;
    * @return string The greeting to be displayed to the user&lt;br /&gt;
    */&lt;br /&gt;
    function getGreeting()&lt;br /&gt;
    {&lt;br /&gt;
        return &#039;Hello, World!&#039;;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice a line that starts with jimport. The jimport function is used to load files from the Joomla! framework that are required for our component. This particular statement will load the file /libraries/joomla/application/component/model.php. The &#039;.&#039;s are used as directory separators and the last part is the name of the file to load. All files are loaded relative to the libraries directory. This particular file contains the class definition for the JModel class, which is necessary because our model extends this class.&lt;br /&gt;
&lt;br /&gt;
Now that we have created our model, we must modify our view so that it uses it to obtain the greeting.&lt;br /&gt;
&lt;br /&gt;
== Using the Model ==&lt;br /&gt;
&lt;br /&gt;
The Joomla! framework is setup in such a way that the controller will automatically load the model that has the same name as the view and will push it into the view. Since our view is called &#039;Hello&#039;, our &#039;Hello&#039; model will automatically be loaded and pushed into the view. Therefore, we can easily retrieve a reference to our model using the JView::getModel() method. (If the model had not followed this convention, we could have passed the model name to [http://api.joomla.org/Joomla-Framework/Application/JView.html#getModel JView::getModel()])&lt;br /&gt;
&lt;br /&gt;
Our previous view code contained the lines:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;$greeting = &amp;quot;Hello World!&amp;quot;;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To take advantage of our model, we change this line to:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;$model = &amp;amp;$this-&amp;gt;getModel();&lt;br /&gt;
$greeting = $model-&amp;gt;getGreeting();&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The complete view now 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;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_2&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;
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;
 * @package    HelloWorld&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
class HelloViewHello extends JView&lt;br /&gt;
{&lt;br /&gt;
    function display($tpl = null)&lt;br /&gt;
    {&lt;br /&gt;
        $model = &amp;amp;$this-&amp;gt;getModel();&lt;br /&gt;
        $greeting = $model-&amp;gt;getGreeting();&lt;br /&gt;
        $this-&amp;gt;assignRef( &#039;greeting&#039;,	$greeting );&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;
=== Adding the File to the Package ===&lt;br /&gt;
&lt;br /&gt;
All that remains is to add an entry to the XML file so that our new model will be copied. The Joomla! framework will look for our model in the models directory, so the entry for this file will look like (it should be added to the site section):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;filename&amp;gt;models/hello.php&amp;lt;/filename&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Our new hello.xml file will look like:&lt;br /&gt;
 &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;
&amp;lt;install type=&amp;quot;component&amp;quot; version=&amp;quot;1.5.0&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;name&amp;gt;Hello&amp;lt;/name&amp;gt;&lt;br /&gt;
 &amp;lt;!-- The following elements are optional and free of formatting constraints --&amp;gt;&lt;br /&gt;
 &amp;lt;creationDate&amp;gt;2007-02-22&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;1.01&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 component ...&amp;lt;/description&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;controller.php&amp;lt;/filename&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;models/hello.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
  &amp;lt;filename&amp;gt;models/index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
  &amp;lt;filename&amp;gt;views/index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
  &amp;lt;filename&amp;gt;views/hello/index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
  &amp;lt;filename&amp;gt;views/hello/view.html.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
  &amp;lt;filename&amp;gt;views/hello/tmpl/default.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
  &amp;lt;filename&amp;gt;views/hello/tmpl/index.html&amp;lt;/filename&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;
&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;/files&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/install&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
We now have a simple MVC component. Each element is very simple at this point, but provides a great deal of flexibility and power.&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;
&lt;br /&gt;
== Download ==&lt;br /&gt;
&lt;br /&gt;
The component can be downloaded at: [http://joomlacode.org/gf/download/frsrelease/8109/29434/com_hello2_01.zip com_hello2_01]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Burek</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J1.5:Developing_a_MVC_Component/Introduction&amp;diff=64560</id>
		<title>J1.5:Developing a MVC Component/Introduction</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J1.5:Developing_a_MVC_Component/Introduction&amp;diff=64560"/>
		<updated>2012-01-29T19:33:51Z</updated>

		<summary type="html">&lt;p&gt;Burek: /* View */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
A software framework is the base of an application that can be used by a developer. The framework in Joomla! 1.5 unleashes a great deal of power for them. The Joomla! code has been designed for extensibility. This tutorial will guide you through the process of developing a component using the framework.&lt;br /&gt;
&lt;br /&gt;
The scope of this project will be to develop a simple Hello World! component. In future tutorials, this simple framework will be built upon to show the full power and versatility of the MVC design pattern in Joomla!&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
You need Joomla! 1.5 or greater for this tutorial.&lt;br /&gt;
&lt;br /&gt;
== Introduction to Model-View-Controller ==&lt;br /&gt;
[[image:MVC basics.png|frameless|right]]While the idea behind a component may seem extremely simple, code can quickly become very complex as additional features are added or the interface is customized.&lt;br /&gt;
&lt;br /&gt;
Model-View-Controller (herein referred to as MVC) is a software design pattern that can be used to organize code in such a way that the business logic and data presentation are separate. The premise behind this approach is that if the business logic is grouped into one section, then the interface and user interaction that surrounds the data can be revised and customized without having to reprogram the business logic. MVC was originally developed to map the traditional input, processing, output roles into a logical GUI architecture.&lt;br /&gt;
&lt;br /&gt;
These three main roles are the basis for the Joomla MVC. They are described here in brief, but for a more thorough explanation, please refer to the links provided at the end of this tutorial.&lt;br /&gt;
&lt;br /&gt;
=== Model ===&lt;br /&gt;
The model is the part of the component that encapsulates the application&#039;s data. It will often provide routines to manage and manipulate this data in a meaningful way in addition to routines that retrieve the data from the model. In our case, the model will contain methods to add, remove and update information about the greetings in the database. It will also contain methods to retrieve the list of greetings from the database. In general, the underlying data access technique should be encapsulated in the model. In this way, if an application is to be moved from a system that utilizes a flat file to store its information to a system that uses a database, the model is the only element that needs to be changed, not the view or the controller.&lt;br /&gt;
&lt;br /&gt;
=== View ===&lt;br /&gt;
The view is the part of the component that is used to render the data from the model in a manner that is suitable for interaction. For a web-based application, the view would generally be an HTML page that is returned to the user. The view pulls data from the model (which is passed to it from the controller) and feeds the data into a template which is populated and presented to the user. The view does not cause the data to be modified in any way, it only displays data retrieved from the model.&lt;br /&gt;
&lt;br /&gt;
=== Controller ===&lt;br /&gt;
The controller is responsible for responding to user actions. In the case of a web application, a user action is (generally) a page request. The controller will determine what request is being made by the user and respond appropriately by triggering the model to manipulate the data appropriately and passing the model into the view. The controller does not display the data in the model, it only triggers methods in the model which modify the data, and then pass the model into the view which displays the data.&lt;br /&gt;
&lt;br /&gt;
=== MVC connection ===&lt;br /&gt;
[[image:MVC joomla.png|frameless|right]]The simplified picture on the right depicts the basic components being used within Joomla. Besides the Model, the View and the Controller, an Entry Point has been added that is depicted as a small circle. Attached to the viewer (view) a Template has been added. With these five components you should be able to understand this tutorial about making a basic Joomla! MVC component.&lt;br /&gt;
&lt;br /&gt;
Part 1 of the tutorial only focuses on the Controller and the View (with the use of the Template); these are marked with the blue colour in the picture. Part 2 adds and Part 3 extends the model functionality for the data manipulation abstraction; marked with the green colour in the picture. &lt;br /&gt;
&lt;br /&gt;
Keep in mind that this simplified picture only applies for the site section (i.e the front-end). An identical picture is applicable for the admin section (i.e. the back-end). The administrative section is taken care of in Parts 4 through 6 of this component development tutorial. Both the site and the admin section are maintained and configured in an XML based installation file (typically termed a manifest file).&lt;br /&gt;
&lt;br /&gt;
== Joomla! MVC Implementation ==&lt;br /&gt;
In Joomla!, the MVC pattern is implemented using three classes: [http://api.joomla.org/Joomla-Framework/Application/JModel.html JModel], [http://api.joomla.org/Joomla-Framework/Application/JView.html JView] and [http://api.joomla.org/Joomla-Framework/Application/JController.html JController]. For more detailed information about these classes, please refer to the API reference documentation (WIP).&lt;br /&gt;
&lt;br /&gt;
For learning purposes and debugging, adding a run-time debugger to your Joomla! site might be a good extension especially during development of your (tutorial) component. A good example is the community project [http://extensions.joomla.org/extensions/miscellaneous/development/1509/details J!Dump] that has the advantage of being a pop-up which leaves the view output unchanged. The J!Dump system allows you to view not only your development properties but also the methods.&lt;br /&gt;
&lt;br /&gt;
== Creating a Component ==&lt;br /&gt;
For our basic component, we only require five files:&lt;br /&gt;
&lt;br /&gt;
* site/hello.php - this is the entry point to our component&lt;br /&gt;
* site/controller.php - this file contains our base controller&lt;br /&gt;
* site/views/hello/view.html.php - this file retrieves the necessary data and pushes it into the template&lt;br /&gt;
* site/views/hello/tmpl/default.php - this is the template for our output&lt;br /&gt;
* hello.xml - this is an XML (manifest) file that tells Joomla! how to install our component.&lt;br /&gt;
&lt;br /&gt;
Remember that the filename for the entry point must have the same name of the component. For example, if you call your component &amp;quot;Very Intricate Name Component&amp;quot;, at install time (see below in the hello.xml section) Joomla! will create the folder com_veryintricatenamecomponent and the entry point php file must be named veryintricatenamecomponent.php otherwise it will not work. Be aware that use of some special characters, notibly the underscore &#039;_&#039;, may have special meaning in Joomla and should be avoided in component names or files.&lt;br /&gt;
&lt;br /&gt;
The site directory here is for the parts of the component which are installed in the front end site.&lt;br /&gt;
&lt;br /&gt;
=== Naming conventions ===&lt;br /&gt;
&lt;br /&gt;
Main article: [[Naming conventions]]&lt;br /&gt;
&lt;br /&gt;
At this point it is important to say that some words are reserved for using in component or its class names, and violating some of that will produce a hard for debugging error. One of them is &amp;quot;view&amp;quot; (in any character case) for view class (subclass of JView) and controller class (subclass of JController), because view class need to have first part of name the same as controller class name, and component name (although violating of last one won&#039;t produce an error, it&#039;s just a useful convention).&lt;br /&gt;
&lt;br /&gt;
All filenames and foldernames for models, views and controllers must be lower-case in order to operate well on Unix/Linux-systems.&lt;br /&gt;
&lt;br /&gt;
=== Creating the Entry Point ===&lt;br /&gt;
{{review}}&lt;br /&gt;
Joomla! is always accessed through a single point of entry: index.php for the Site Application or administrator/index.php for the Administrator Application. The application will then load the required component, based on the value of &#039;option&#039; in the URL or in the POST data. For our component, the URL would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;index.php?option=com_hello&amp;amp;view=hello&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will load our main file, which can be seen as the single point of entry for our component: components/com_hello/hello.php.&lt;br /&gt;
&lt;br /&gt;
The code for this file is fairly typical across components. &lt;br /&gt;
 &lt;br /&gt;
site/hello.php:&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;
 * components/com_hello/hello.php&lt;br /&gt;
 * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_1&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;
// 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;HelloController&#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::getWord( &#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 first statement is a security check.&lt;br /&gt;
&lt;br /&gt;
JPATH_COMPONENT is the absolute path to the current component, in our case components/com_hello. If you specifically need either the Site component or the Administrator component, you can use JPATH_COMPONENT_SITE or JPATH_COMPONENT_ADMINISTRATOR.&lt;br /&gt;
&lt;br /&gt;
DS is the directory separator of your system: either &#039;/&#039; or &#039;\&#039;. This is automatically set by the framework so the developer doesn&#039;t have to worry about developing different versions for different server OSs. The &#039;DS&#039; constant should always be used when referring to files on the local server.&lt;br /&gt;
&lt;br /&gt;
After loading the base controller, we check if a specific controller is needed. In this component, the base controller is the only controller, but we will leave this conditional check &amp;quot;in place&amp;quot; for future use.&lt;br /&gt;
&lt;br /&gt;
JRequest::getWord() finds a word variable in the URL or the POST data. So if our URL is index.php?option=com_hello&amp;amp;controller=controller_name, then we can retrieve our controller name in our component using: echo JRequest::getWord(&#039;controller&#039;);&lt;br /&gt;
&lt;br /&gt;
Now we have our base controller &#039;HelloController&#039; in com_hello/controller.php, and, if needed, additional controllers like &#039;HelloControllerController1&#039; in com_hello/controllers/controller1.php. Using this standard naming scheme will make things easy later on: &#039;{Componentname}{Controller}{Controllername}&#039;&lt;br /&gt;
&lt;br /&gt;
After the controller is created, we instruct the controller to execute the task, as defined in the URL: index.php?option=com_hello&amp;amp;task=sometask. If no task is set, the default task &#039;display&#039; will be assumed. When display is used, the &#039;view&#039; variable will decide what will be displayed. Other common tasks are save, edit, new...&lt;br /&gt;
&lt;br /&gt;
The controller might decide to redirect the page, usually after a task like &#039;save&#039; has been completed. This last statement takes care of the actual redirection.&lt;br /&gt;
&lt;br /&gt;
The main entry point (hello.php) essentially passes control to the controller, which handles performing the task that was specified in the request.&lt;br /&gt;
&lt;br /&gt;
Note that we don&#039;t use a closing php tag in this file: ?&amp;gt;. The reason for this is that we will not have any unwanted whitespace in the output code. This is default practice since Joomla! 1.5, and will be used for all php-only files.&lt;br /&gt;
&lt;br /&gt;
=== Creating the Controller ===&lt;br /&gt;
Our component only has one task - greet the world. Therefore, the controller will be very simple. No data manipulation is required. All that needs to be done is the appropriate view loaded. We will have only one method in our controller: display(). Most of the required functionality is built into the JController class, so all that we need to do is invoke the JController::display() method.&lt;br /&gt;
&lt;br /&gt;
The code for the base controller site/controller.php is:&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_1&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;
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;
 * @package    Joomla.Tutorials&lt;br /&gt;
 * @subpackage Components&lt;br /&gt;
 */&lt;br /&gt;
class HelloController extends JController&lt;br /&gt;
{&lt;br /&gt;
    /**&lt;br /&gt;
     * Method to display the view&lt;br /&gt;
     *&lt;br /&gt;
     * @access    public&lt;br /&gt;
     */&lt;br /&gt;
    function display()&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 JController constructor will always register a display() task and unless otherwise specified (using the registerDefaultTask() method), it will set it as the default task.&lt;br /&gt;
&lt;br /&gt;
This barebones display() method isn&#039;t really even necessary since all it does is invoke the parent constructor. However, it is a good visual clue to indicate what is happening in the controller.&lt;br /&gt;
&lt;br /&gt;
The JController::display() method will determine the name of the view and layout from the request and load that view and set the layout. When you create a menu item for your component, the menu manager will allow the administrator to select the view that they would like the menu link to display and to specify the layout. A view usually refers to a view of a certain set of data (i.e. a list of cars, a list of events, a single car, a single event). A layout is a way that that view is organized.&lt;br /&gt;
&lt;br /&gt;
In our component, we will have a single view called hello, and a single layout (default).&lt;br /&gt;
&lt;br /&gt;
=== Creating the View ===&lt;br /&gt;
The task of the view is very simple: It retrieves the data to be displayed and pushes it into the template. Data is pushed into the template using the JView::assignRef method.&lt;br /&gt;
&amp;lt;small&amp;gt;(Note: The key (the first argument) passed to the assignRef method cannot be preceded by an underscore i.e. $this-&amp;gt;assignRef(&#039;_greeting&#039;,$greeting). Doing so will cause the assignRef method to return false and your variable will not be pushed into the template.)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The code for the view at site/views/hello/view.html.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_1&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;
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;
 * @package    HelloWorld&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
class HelloViewHello extends JView&lt;br /&gt;
{&lt;br /&gt;
    function display($tpl = null)&lt;br /&gt;
    {&lt;br /&gt;
        $greeting = &amp;quot;Hello World!&amp;quot;;&lt;br /&gt;
        $this-&amp;gt;assignRef( &#039;greeting&#039;, $greeting );&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;
==== Creating the Template ====&lt;br /&gt;
&lt;br /&gt;
Joomla! templates/layouts are regular PHP files that are used to layout the data from the view in a particular manner. The variables assigned by the JView::assignRef method can be accessed from the template using $this-&amp;gt;{propertyname} (see the template code below for an example).&lt;br /&gt;
&lt;br /&gt;
Our template is very simple: we only want to display the greeting that was passed in from the view - this file is:&amp;lt;br&amp;gt;site/views/hello/tmpl/default.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;
// No direct access&lt;br /&gt;
&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;); ?&amp;gt;&lt;br /&gt;
&amp;lt;h1&amp;gt;&amp;lt;?php echo $this-&amp;gt;greeting; ?&amp;gt;&amp;lt;/h1&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Wrapping It All Up - Creating the hello.xml File ===&lt;br /&gt;
It is possible to install a component manually by copying the files using an FTP client and modifying the database tables. It is more efficient to create a package file that will allow the Joomla! Installer to do this for you. This package file contains a variety of information:&lt;br /&gt;
&lt;br /&gt;
* basic descriptive details about your component (i.e. name), and optionally, a description, copyright and license information.&lt;br /&gt;
* a list of files that need to be copied.&lt;br /&gt;
* optionally, a PHP file that performs additional install and uninstall operations.&lt;br /&gt;
* optionally, an SQL file which contains database queries that should be executed upon install/uninstall&lt;br /&gt;
&lt;br /&gt;
The format of the XML file at hello.xml is as follows:&lt;br /&gt;
 &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;
&amp;lt;install type=&amp;quot;component&amp;quot; version=&amp;quot;1.5.0&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;name&amp;gt;Hello&amp;lt;/name&amp;gt;&lt;br /&gt;
 &amp;lt;!-- The following elements are optional and free of formatting constraints --&amp;gt;&lt;br /&gt;
 &amp;lt;creationDate&amp;gt;2007-02-22&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;1.01&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 component ...&amp;lt;/description&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;controller.php&amp;lt;/filename&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;views/index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
  &amp;lt;filename&amp;gt;views/hello/index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
  &amp;lt;filename&amp;gt;views/hello/view.html.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
  &amp;lt;filename&amp;gt;views/hello/tmpl/default.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
  &amp;lt;filename&amp;gt;views/hello/tmpl/index.html&amp;lt;/filename&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;
&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;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/install&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{notice|&lt;br /&gt;
Put this xml file, also called manifest, in the root of your package (because the installer will take its path as the root path for all other files).{{1}}Don&#039;t include itself under &amp;lt;files&amp;gt;...}}&lt;br /&gt;
&lt;br /&gt;
You may have noticed the manifest source above mentioned files we have not discussed. These are the index.html files and the admin files. An index.html file is placed in each directory to prevent prying users from getting a directory listing. If there is no index.html file, some web servers will list the directory contents. This is often undesirable. These files have the simple line:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;html&amp;gt;&amp;lt;body bgcolor=&amp;quot;#FFFFFF&amp;quot;&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will simply display a blank page.&lt;br /&gt;
&lt;br /&gt;
The hello.php file in the admin folder is the entry point for the our component&#039;s admin section. Since our component has no administrator needs (yet), this file will have the same content as the index.html files for now.&lt;br /&gt;
&lt;br /&gt;
If you&#039;ve followed along, you can visit URL index.php?option=com_hello to see your work.  To do this, zip up the main folder and install via the extensions manager.  If it still does not work, download the package at the bottom of this page and install for a working example.&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;
* mjaz&lt;br /&gt;
* staalanden&lt;br /&gt;
* dannystaple&lt;br /&gt;
* Stilgar&lt;br /&gt;
* presto&lt;br /&gt;
&lt;br /&gt;
== Download ==&lt;br /&gt;
The component can be downloaded at: [http://joomlacode.org/gf/download/frsrelease/8108/29433/com_hello1_01.zip com_hello1_01]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Burek</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J1.5_talk:Creating_an_Authentication_Plugin_for_Joomla&amp;diff=17745</id>
		<title>J1.5 talk:Creating an Authentication Plugin for Joomla</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J1.5_talk:Creating_an_Authentication_Plugin_for_Joomla&amp;diff=17745"/>
		<updated>2009-11-16T16:25:25Z</updated>

		<summary type="html">&lt;p&gt;Burek: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A google search on &#039;joomla onauthenticate example&#039; returns this tutorial so I suspect many people tasked with configuring a Joomla! 1.5 system to authenticate a user login against a database external to Joomla&#039;s will no doubt arrive here and use the code presented as a starting point to implementing their own auth plugin. At least that is what happend to me!&lt;br /&gt;
&lt;br /&gt;
In this tutorial it says that the example is based on example.php, which can be found in the plugins/authentication directory of your Joomla installation.&lt;br /&gt;
&lt;br /&gt;
After scratching my head and wondering if I could be any dumber than I already am, I noted the following differences between the code in the tutorial and the code in the plugins/authentication/example.php file in my Joomla 1.5.13 installation.&lt;br /&gt;
&lt;br /&gt;
In fact, the code is so different that it may explain why I have had so much trouble implementing the simple process of authenticating against a table in another MySQL database on the same machine.&lt;br /&gt;
&lt;br /&gt;
Would someone be so kind as to confirm that these differences are problematic or deconfuse me on this issue? Please bear in mind that I&#039;m a perl guy drowning in php.&lt;br /&gt;
&lt;br /&gt;
There are two issues:&lt;br /&gt;
&lt;br /&gt;
1. The constructors for the plugin are defined differently.&lt;br /&gt;
&lt;br /&gt;
Tutorial:&lt;br /&gt;
&lt;br /&gt;
function plgAuthenticationMyauth(&amp;amp; $subject) {&lt;br /&gt;
    parent::__construct($subject);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
example.php:&lt;br /&gt;
&lt;br /&gt;
function plgAuthenticationExample(&amp;amp; $subject, $config)&lt;br /&gt;
{&lt;br /&gt;
  parent::__construct($subject, $config);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
2. The definitions of the parameters that onAuthenticate expects are different.&lt;br /&gt;
&lt;br /&gt;
Tutorial:&lt;br /&gt;
&lt;br /&gt;
The onAuthenticate() method is the method that will be called when the system is trying to use your plugin to authenticate the user. This method will be passed three parameters: the username, the password, and a reference to an object of type JAuthenticationResponse&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
     * This method should handle any authentication and report back to the subject&lt;br /&gt;
     * This example uses simple authentication - it checks if the password is the reverse&lt;br /&gt;
     * of the username (and the user exists in the database).&lt;br /&gt;
     *&lt;br /&gt;
     * @access    public&lt;br /&gt;
     * @param    string    $username    Username for authentication&lt;br /&gt;
     * @param    string    $password    Password for authentication&lt;br /&gt;
     * @param    object    $response    Authentication response object&lt;br /&gt;
     * @return    boolean&lt;br /&gt;
     * @since 1.5&lt;br /&gt;
     */&lt;br /&gt;
&lt;br /&gt;
function onAuthenticate( $username, $password, &amp;amp;$response )&lt;br /&gt;
&lt;br /&gt;
example.php:&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * This method should handle any authentication and report back to the subject&lt;br /&gt;
 *&lt;br /&gt;
 * @access      public&lt;br /&gt;
 * @param       array   $credentials    Array holding the user credentials&lt;br /&gt;
 * @param       array   $options                Array of extra options&lt;br /&gt;
 * @param       object  $response               Authentication response object&lt;br /&gt;
 * @return      boolean&lt;br /&gt;
 * @since       1.5&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
function onAuthenticate( $credentials, $options, &amp;amp;$response )&lt;br /&gt;
&lt;br /&gt;
== Invalid link ==&lt;br /&gt;
&lt;br /&gt;
The link to http://api.joomla.org/Joomla-Framework/User/JAuthenticationResponse.html is not displayed correctly.&lt;/div&gt;</summary>
		<author><name>Burek</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J1.5_talk:Creating_an_Authentication_Plugin_for_Joomla&amp;diff=17744</id>
		<title>J1.5 talk:Creating an Authentication Plugin for Joomla</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J1.5_talk:Creating_an_Authentication_Plugin_for_Joomla&amp;diff=17744"/>
		<updated>2009-11-16T16:25:03Z</updated>

		<summary type="html">&lt;p&gt;Burek: /* Invalid link */ new section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A google search on &#039;joomla onauthenticate example&#039; returns this tutorial so I suspect many people tasked with configuring a Joomla! 1.5 system to authenticate a user login against a database external to Joomla&#039;s will no doubt arrive here and use the code presented as a starting point to implementing their own auth plugin. At least that is what happend to me!&lt;br /&gt;
&lt;br /&gt;
In this tutorial it says that the example is based on example.php, which can be found in the plugins/authentication directory of your Joomla installation.&lt;br /&gt;
&lt;br /&gt;
After scratching my head and wondering if I could be any dumber than I already am, I noted the following differences between the code in the tutorial and the code in the plugins/authentication/example.php file in my Joomla 1.5.13 installation.&lt;br /&gt;
&lt;br /&gt;
In fact, the code is so different that it may explain why I have had so much trouble implementing the simple process of authenticating against a table in another MySQL database on the same machine.&lt;br /&gt;
&lt;br /&gt;
Would someone be so kind as to confirm that these differences are problematic or deconfuse me on this issue? Please bear in mind that I&#039;m a perl guy drowning in php.&lt;br /&gt;
&lt;br /&gt;
There are two issues:&lt;br /&gt;
&lt;br /&gt;
1. The constructors for the plugin are defined differently.&lt;br /&gt;
&lt;br /&gt;
Tutorial:&lt;br /&gt;
&lt;br /&gt;
function plgAuthenticationMyauth(&amp;amp; $subject) {&lt;br /&gt;
    parent::__construct($subject);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
example.php:&lt;br /&gt;
&lt;br /&gt;
function plgAuthenticationExample(&amp;amp; $subject, $config)&lt;br /&gt;
{&lt;br /&gt;
  parent::__construct($subject, $config);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
2. The definitions of the parameters that onAuthenticate expects are different.&lt;br /&gt;
&lt;br /&gt;
Tutorial:&lt;br /&gt;
&lt;br /&gt;
The onAuthenticate() method is the method that will be called when the system is trying to use your plugin to authenticate the user. This method will be passed three parameters: the username, the password, and a reference to an object of type JAuthenticationResponse&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
     * This method should handle any authentication and report back to the subject&lt;br /&gt;
     * This example uses simple authentication - it checks if the password is the reverse&lt;br /&gt;
     * of the username (and the user exists in the database).&lt;br /&gt;
     *&lt;br /&gt;
     * @access    public&lt;br /&gt;
     * @param    string    $username    Username for authentication&lt;br /&gt;
     * @param    string    $password    Password for authentication&lt;br /&gt;
     * @param    object    $response    Authentication response object&lt;br /&gt;
     * @return    boolean&lt;br /&gt;
     * @since 1.5&lt;br /&gt;
     */&lt;br /&gt;
&lt;br /&gt;
function onAuthenticate( $username, $password, &amp;amp;$response )&lt;br /&gt;
&lt;br /&gt;
example.php:&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * This method should handle any authentication and report back to the subject&lt;br /&gt;
 *&lt;br /&gt;
 * @access      public&lt;br /&gt;
 * @param       array   $credentials    Array holding the user credentials&lt;br /&gt;
 * @param       array   $options                Array of extra options&lt;br /&gt;
 * @param       object  $response               Authentication response object&lt;br /&gt;
 * @return      boolean&lt;br /&gt;
 * @since       1.5&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
function onAuthenticate( $credentials, $options, &amp;amp;$response )&lt;br /&gt;
&lt;br /&gt;
The link to http://api.joomla.org/Joomla-Framework/User/JAuthenticationResponse.html is not displayed correctly.&lt;br /&gt;
&lt;br /&gt;
== Invalid link ==&lt;br /&gt;
&lt;br /&gt;
The link to http://api.joomla.org/Joomla-Framework/User/JAuthenticationResponse.html is not displayed correctly.&lt;/div&gt;</summary>
		<author><name>Burek</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J1.5_talk:Creating_an_Authentication_Plugin_for_Joomla&amp;diff=17743</id>
		<title>J1.5 talk:Creating an Authentication Plugin for Joomla</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J1.5_talk:Creating_an_Authentication_Plugin_for_Joomla&amp;diff=17743"/>
		<updated>2009-11-16T16:24:47Z</updated>

		<summary type="html">&lt;p&gt;Burek: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A google search on &#039;joomla onauthenticate example&#039; returns this tutorial so I suspect many people tasked with configuring a Joomla! 1.5 system to authenticate a user login against a database external to Joomla&#039;s will no doubt arrive here and use the code presented as a starting point to implementing their own auth plugin. At least that is what happend to me!&lt;br /&gt;
&lt;br /&gt;
In this tutorial it says that the example is based on example.php, which can be found in the plugins/authentication directory of your Joomla installation.&lt;br /&gt;
&lt;br /&gt;
After scratching my head and wondering if I could be any dumber than I already am, I noted the following differences between the code in the tutorial and the code in the plugins/authentication/example.php file in my Joomla 1.5.13 installation.&lt;br /&gt;
&lt;br /&gt;
In fact, the code is so different that it may explain why I have had so much trouble implementing the simple process of authenticating against a table in another MySQL database on the same machine.&lt;br /&gt;
&lt;br /&gt;
Would someone be so kind as to confirm that these differences are problematic or deconfuse me on this issue? Please bear in mind that I&#039;m a perl guy drowning in php.&lt;br /&gt;
&lt;br /&gt;
There are two issues:&lt;br /&gt;
&lt;br /&gt;
1. The constructors for the plugin are defined differently.&lt;br /&gt;
&lt;br /&gt;
Tutorial:&lt;br /&gt;
&lt;br /&gt;
function plgAuthenticationMyauth(&amp;amp; $subject) {&lt;br /&gt;
    parent::__construct($subject);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
example.php:&lt;br /&gt;
&lt;br /&gt;
function plgAuthenticationExample(&amp;amp; $subject, $config)&lt;br /&gt;
{&lt;br /&gt;
  parent::__construct($subject, $config);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
2. The definitions of the parameters that onAuthenticate expects are different.&lt;br /&gt;
&lt;br /&gt;
Tutorial:&lt;br /&gt;
&lt;br /&gt;
The onAuthenticate() method is the method that will be called when the system is trying to use your plugin to authenticate the user. This method will be passed three parameters: the username, the password, and a reference to an object of type JAuthenticationResponse&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
     * This method should handle any authentication and report back to the subject&lt;br /&gt;
     * This example uses simple authentication - it checks if the password is the reverse&lt;br /&gt;
     * of the username (and the user exists in the database).&lt;br /&gt;
     *&lt;br /&gt;
     * @access    public&lt;br /&gt;
     * @param    string    $username    Username for authentication&lt;br /&gt;
     * @param    string    $password    Password for authentication&lt;br /&gt;
     * @param    object    $response    Authentication response object&lt;br /&gt;
     * @return    boolean&lt;br /&gt;
     * @since 1.5&lt;br /&gt;
     */&lt;br /&gt;
&lt;br /&gt;
function onAuthenticate( $username, $password, &amp;amp;$response )&lt;br /&gt;
&lt;br /&gt;
example.php:&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * This method should handle any authentication and report back to the subject&lt;br /&gt;
 *&lt;br /&gt;
 * @access      public&lt;br /&gt;
 * @param       array   $credentials    Array holding the user credentials&lt;br /&gt;
 * @param       array   $options                Array of extra options&lt;br /&gt;
 * @param       object  $response               Authentication response object&lt;br /&gt;
 * @return      boolean&lt;br /&gt;
 * @since       1.5&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
function onAuthenticate( $credentials, $options, &amp;amp;$response )&lt;br /&gt;
&lt;br /&gt;
The link to http://api.joomla.org/Joomla-Framework/User/JAuthenticationResponse.html is not displayed correctly.&lt;/div&gt;</summary>
		<author><name>Burek</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J1.5_talk:Developing_a_MVC_Component/Using_the_Database&amp;diff=14974</id>
		<title>J1.5 talk:Developing a MVC Component/Using the Database</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J1.5_talk:Developing_a_MVC_Component/Using_the_Database&amp;diff=14974"/>
		<updated>2009-07-21T09:09:27Z</updated>

		<summary type="html">&lt;p&gt;Burek: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Although it is mentioned in the article, I think it is important to underline where the install.sql and uninstall.sql files have to be placed:&lt;br /&gt;
&lt;br /&gt;
install.sql and uninstall.sql files have to be mentioned in two places:&lt;br /&gt;
* In one of the file sections. For example:&lt;br /&gt;
   &amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;filename&amp;gt;...&amp;lt;/filename&amp;gt;&lt;br /&gt;
      &amp;lt;filename&amp;gt;...&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;
* In the &#039;&#039;install&#039;&#039; / &#039;&#039;uninstall&#039;&#039; sections.&lt;br /&gt;
&lt;br /&gt;
Of course, the files have to be copied in the correct folder (in the example, it should be the &#039;&#039;admin&#039;&#039; folder).&lt;br /&gt;
&lt;br /&gt;
When data is read from a database, it can be retrieved in the class constructor:&lt;br /&gt;
&lt;br /&gt;
   // The constructor accesses the database, and retrieves all properties.&lt;br /&gt;
   function __construct($config = array()) {&lt;br /&gt;
      parent::__construct($config);           // To transmit configuration to parent class.&lt;br /&gt;
      $db =&amp;amp; JFactory::getDBO();		&lt;br /&gt;
      $query = &#039;SELECT greeting FROM #__hello&#039;;&lt;br /&gt;
      $db-&amp;gt;setQuery( $query );&lt;br /&gt;
      $this-&amp;gt;greeting = $db-&amp;gt;loadResult();&lt;br /&gt;
   }&lt;br /&gt;
   // The private property&lt;br /&gt;
   var $greeting;&lt;br /&gt;
   // The public property accessor&lt;br /&gt;
   function getGreeting() {&lt;br /&gt;
      return $this-&amp;gt;greeting;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
/* 2009-07-21 */&lt;br /&gt;
* Are those file names for &amp;quot;install.utf8.sql&amp;quot; and &amp;quot;uninstall.utf8.sql&amp;quot; correctly written into XML file? I see files &amp;quot;install.sql&amp;quot; and &amp;quot;uninstall.sql&amp;quot;, but in the text, there says the files will be named &amp;quot;install.utf8.sql&amp;quot; and &amp;quot;uninstall.utf8.sql&amp;quot;?&lt;/div&gt;</summary>
		<author><name>Burek</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J1.5_talk:Developing_a_MVC_Component/Using_the_Database&amp;diff=14973</id>
		<title>J1.5 talk:Developing a MVC Component/Using the Database</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J1.5_talk:Developing_a_MVC_Component/Using_the_Database&amp;diff=14973"/>
		<updated>2009-07-21T09:08:33Z</updated>

		<summary type="html">&lt;p&gt;Burek: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Although it is mentioned in the article, I think it is important to underline where the install.sql and uninstall.sql files have to be placed:&lt;br /&gt;
&lt;br /&gt;
install.sql and uninstall.sql files have to be mentioned in two places:&lt;br /&gt;
* In one of the file sections. For example:&lt;br /&gt;
   &amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;filename&amp;gt;...&amp;lt;/filename&amp;gt;&lt;br /&gt;
      &amp;lt;filename&amp;gt;...&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;
* In the &#039;&#039;install&#039;&#039; / &#039;&#039;uninstall&#039;&#039; sections.&lt;br /&gt;
&lt;br /&gt;
Of course, the files have to be copied in the correct folder (in the example, it should be the &#039;&#039;admin&#039;&#039; folder).&lt;br /&gt;
&lt;br /&gt;
When data is read from a database, it can be retrieved in the class constructor:&lt;br /&gt;
&lt;br /&gt;
   // The constructor accesses the database, and retrieves all properties.&lt;br /&gt;
   function __construct($config = array()) {&lt;br /&gt;
      parent::__construct($config);           // To transmit configuration to parent class.&lt;br /&gt;
      $db =&amp;amp; JFactory::getDBO();		&lt;br /&gt;
      $query = &#039;SELECT greeting FROM #__hello&#039;;&lt;br /&gt;
      $db-&amp;gt;setQuery( $query );&lt;br /&gt;
      $this-&amp;gt;greeting = $db-&amp;gt;loadResult();&lt;br /&gt;
   }&lt;br /&gt;
   // The private property&lt;br /&gt;
   var $greeting;&lt;br /&gt;
   // The public property accessor&lt;br /&gt;
   function getGreeting() {&lt;br /&gt;
      return $this-&amp;gt;greeting;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
Are those file names for &amp;quot;install.utf8.sql&amp;quot; and &amp;quot;uninstall.utf8.sql&amp;quot; correctly written into XML file? I see files &amp;quot;install.sql&amp;quot; and &amp;quot;uninstall.sql&amp;quot;, but in the text, there says the files will be named &amp;quot;install.utf8.sql&amp;quot; and &amp;quot;uninstall.utf8.sql&amp;quot;?&lt;/div&gt;</summary>
		<author><name>Burek</name></author>
	</entry>
</feed>