Joseph L. LeBlanc
homeportfoliojoomlabiocontactblog
articles
guides
tutorials
all
forum
Subscribe in NewsGator Online

Learning Joomla! for the first time? Buy the Joomla! 1.5 Essential training CD-ROM or watch it on Lynda.com.

 

Welcome to Joseph LeBlanc's Joomla resources. First time visitors will find the Daily Message Component Tutorial to be helpful. (Daily Message for Joomla 1.0 is also available, as well as many other tutorials based around it). In addition to the tutorials, there are articles covering conceptual topics, such as the oft-asked question "What is the difference between a component and a module?" To receive alerts for new tutorials and articles, choose a newsfeed at the right appropriate for your newsreader.

PDF Print E-mail

 

dailymessage.xml

 

<?xml version="1.0" ?>

 

This tag defines the version of XML used for the document. Most XML files in circulation are written in version 1.0. You can read more about XML at www.w3c.org.

 

<mosinstall type="component">

 

The mosinstall tag tells Joomla what to extension to prepare for. This code is installing a component as opposed to a module or template.

 

<name>DailyMessage</name>

<creationDate>06/03/2004</creationDate>

<author>Joseph LeBlanc</author>

<copyright>This component in released under the GNU/GPL License</copyright>

<authorEmail>contact@jlleblanc.com</authorEmail>

<authorUrl>www.jlleblanc.com</authorUrl>

<version>1.0</version>

 

These tags identify the component with a name, a creation date, an author, a copyright, an author e-mail and website, and a version number. This information is later displayed in the component administration section. The name of the component will be used to create a folder named com_[component name]. It should not contain spaces or invalid filename characters.

 

<files>

<filename>dailymessage.php</filename>

</files>

 

The <files> tags enclose a list of files for the frontend display which are individually enclosed by <filename> tags. In this case, only one file is used.

 

<install>

<queries>

<query>

DROP TABLE IF EXISTS `# __joe_dailymessage`;

</query>

<query>

CREATE TABLE `# __joe_dailymessage` (

`id` INT NOT NULL AUTO_INCREMENT,

`message` TEXT NOT NULL,

`date` DATETIME NOT NULL,

`published` TINYINT(1) NOT NULL,

PRIMARY KEY (`id`)

)

</query>

<query>

DROP TABLE IF EXISTS `# __joe_dailymessage_conf`;

</query>

<query>

CREATE TABLE `# __joe_dailymessage_conf` (

`bold` TINYINT(1) NOT NULL,

`italic` TINYINT(1) NOT NULL,

`underline` TINYINT(1) NOT NULL,

`showdate` TINYINT(1) NOT NULL,

`configid` TINYINT(4) NOT NULL

)

</query>

<query>

INSERT INTO `# __joe_dailymessage_conf`(bold, italic, underline, showdate, configid) values(0, 0, 0 , 1, 1);

</query>

</queries>

</install>

 

The installation queries that set up the database tables used by the component are enclosed by <query> tags, which are all enclosed by <install> tags. The string '#_' in the queries is replaced with the Joomla database prefix [usually 'mos']. Two tables are created: one for the daily messages and one for the component configuration. Also, initial values are inserted into the configuration table.

 

<uninstall>

<queries>

<query>

DROP TABLE IF EXISTS `# __joe_dailymessage`;

</query>

<query>

DROP TABLE IF EXISTS `# __joe_dailymessage_conf`;

</query>

</queries>

</uninstall>

 

Similar to the installation tags, the <uninstall> tags enclose the queries necessary to remove the tables used by the component. These queries are only executed when the administrator desires to remove the component.

 

<installfile>

<filename>install.dailymessage.php</filename>

</installfile>

 

<uninstallfile>

<filename>uninstall.dailymessage.php</filename>

</uninstallfile>

 

The <installfile> and <uninstallfile> tags enclose the names of the files to copy that handle additional output for the installation and uninstallation of the component. These are copied to the administrator/com_dailymessage folder.

 

<administration>

<menu>Daily Message</menu>

<submenu>

<menu act="all">Edit Messages</menu>

<menu act="configure">Configure</menu>

</submenu>

 

The <administration> tags enclose everything needed for the backend interface. The <menu> tags enclose the title that appears on the Joomla administration menu under 'Components.' The <submenu> tags enclose the menu items that appear when 'Daily Message' is selected from the 'Components' menu. The property 'act' is used by the backend code to determine which administration screen to display.

 

<files>

<filename>admin.dailymessage.php</filename>

<filename>admin.dailymessage.html.php</filename>

<filename>dailymessage.class.php</filename>

<filename>toolbar.dailymessage.php</filename>

<filename>toolbar.dailymessage.html.php</filename>

</files>

 

The <files> tags within the <administration> tags designate which files to copy to the administration/com_dailymessage folder.

 

</administration>

</mosinstall>