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.

+

This tutorial is part of the [[Developing a Model-View-Controller (MVC) Component for Joomla!2.5]] tutorial. You are encouraged to read the previous parts of the tutorial before reading this.

== Adding a toolbar ==

== Adding a toolbar ==

−

In Joomla!1.6, the administrator interacts generally with components through the use of a toolbar. In the file ''admin/views/helloworlds/view.html.php'' put this content. It will create a basic toolbar and a title for the component.

+

In Joomla, the administrator interacts generally with components through the use of a toolbar. In the file ''admin/views/helloworlds/view.html.php'' put this content. It will create a basic toolbar and a title for the component.

Create a compressed file of this directory or directly download the [http://joomlacode.org/gf/download/frsrelease/11394/58407/com_helloworld-1.6-part09.zip archive], modify the code in /admin/models/helloworld.php 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.

+

Create a compressed file of this directory or directly download the [http://joomlacode.org/gf/download/frsrelease/11394/58407/com_helloworld-1.6-part09.zip archive], modify the code in /admin/models/helloworld.php and install it using the extension manager of Joomla. You can add a menu item of this component using the menu manager in the backend.

<span id="helloworld.xml">

<span id="helloworld.xml">

Line 397:

Line 401:

<source lang="xml">

<source lang="xml">

<?xml version="1.0" encoding="utf-8"?>

<?xml version="1.0" encoding="utf-8"?>

−

<extension type="component" version="1.6.0" method="upgrade">

+

<extension type="component" version="2.5.0" method="upgrade">

<name>Hello World!</name>

<name>Hello World!</name>

−

<!-- The following elements are optional and free of formatting conttraints -->

+

<!-- The following elements are optional and free of formatting constraints -->

Introduction

Adding a toolbar

In Joomla, the administrator interacts generally with components through the use of a toolbar. In the file admin/views/helloworlds/view.html.php put this content. It will create a basic toolbar and a title for the component.

This model inherits from the JModelAdmin class and uses its loadForm method. This method searches for forms in the forms folder. With your favorite file manager and editor, put a file admin/models/forms/helloworld.xml containing:

Create a compressed file of this directory or directly download the archive, modify the code in /admin/models/helloworld.php and install it using the extension manager of Joomla. You can add a menu item of this component using the menu manager in the backend.

helloworld.xml

<?xmlversion="1.0"encoding="utf-8"?><extensiontype="component"version="2.5.0"method="upgrade"><name>Hello World!</name><!-- The following elements are optional and free of formatting constraints --><creationDate>November 2009</creationDate><author>John Doe</author><authorEmail>john.doe@example.org</authorEmail><authorUrl>http://www.example.org</authorUrl><copyright>Copyright Info</copyright><license>License Info</license><!-- The version string is recorded in the components table --><version>0.0.9</version><!-- The description is optional and defaults to the name --><description>COM_HELLOWORLD_DESCRIPTION</description><install><!-- Runs on install --><sql><filedriver="mysql"charset="utf8">sql/install.mysql.utf8.sql</file></sql></install><uninstall><!-- Runs on uninstall --><sql><filedriver="mysql"charset="utf8">sql/uninstall.mysql.utf8.sql</file></sql></uninstall><update><!-- Runs on update; New in 2.5 --><schemas><schemapathtype="mysql">sql/updates/mysql</schemapath></schemas></update><!-- Site Main File Copy Section --><!-- Note the folder attribute: This attribute describes the folder to copy FROM in the package to install therefore files copied in this section are copied from /site/ in the package --><filesfolder="site"><filename>index.html</filename><filename>helloworld.php</filename><filename>controller.php</filename><folder>views</folder><folder>models</folder><folder>language</folder></files><administration><!-- Administration Menu Section --><menu>COM_HELLOWORLD_MENU</menu><!-- Administration Main File Copy Section --><!-- Note the folder attribute: This attribute describes the folder to copy FROM in the package to install therefore files copied in this section are copied from /admin/ in the package --><filesfolder="admin"><!-- Admin Main File Copy Section --><filename>index.html</filename><filename>helloworld.php</filename><filename>controller.php</filename><!-- SQL files section --><folder>sql</folder><!-- tables files section --><folder>tables</folder><!-- models files section --><folder>models</folder><!-- views files section --><folder>views</folder><!-- controllers files section --><folder>controllers</folder></files><languagesfolder="admin"><languagetag="en-GB">language/en-GB/en-GB.com_helloworld.ini</language><languagetag="en-GB">language/en-GB/en-GB.com_helloworld.sys.ini</language></languages></administration></extension>