|
Page 2 of 9 hello_world.xml - Installer file <?xml version="1.0" ?> <mosinstall type="component"> <name>hello_world</name> <creationDate>04/15/2004</creationDate> <author>Doyle Lewis</author> <copyright>This component in released under the GNU/GPL License</copyright> <authorEmail>
This email address is being protected from spam bots, you need Javascript enabled to view it
</authorEmail> <authorUrl>www.mambo-hosting.com</authorUrl> <version>1.0</version> <files> <filename>hello_world.php</filename> </files> <install> <queries> <query>DROP TABLE IF EXISTS `mos_hello_world`;</query> <query>CREATE TABLE `mos_hello_world` ( `id` INT NOT NULL AUTO_INCREMENT, `text` TEXT NOT NULL, `published` TINYINT(1) NOT NULL, PRIMARY KEY (`id`) ) </query> </queries> </install> <uninstall> <queries> <query>DROP TABLE IF EXISTS `mos_hello_world`;</query> </queries> </uninstall> <installfile> <filename>install.hello_world.php</filename> </installfile> <uninstallfile> <filename>uninstall.hello_world.php</filename> </uninstallfile> <administration> <menu>Hello World</menu> <submenu> <menu act="all">Show Text</menu> </submenu> <files> <filename>admin.hello_world.php</filename> <filename>admin.hello_world.html.php</filename> <filename>class.hello_world.php</filename> <filename>toolbar.hello_world.php</filename> <filename>toolbar.hello_world.html.php</filename> </files> </administration> </mosinstall> Now let's look at how the file works: <?xml version="1.0" ?> XML opening container. You will need this on all xml documents. <mosinstall type="component"> Tells Mambo that it will be installing a component <name>hello_world</name> <creationDate>04/15/2004</creationDate> <author>Doyle Lewis</author> <copyright>This component in released under the GNU/GPL License</copyright> <authorEmail>
This email address is being protected from spam bots, you need Javascript enabled to view it
</authorEmail> <authorUrl>www.mambo-hosting.com</authorUrl> <version>1.0</version> Details of the component. All of these should be in there. <files> <filename>hello_world.php</filename> </files> Any files that need to be installed in the frontend of the component. Will be installed to components/com_hello_world/ <install> <queries> <query>DROP TABLE IF EXISTS `mos_hello_world`;</query> <query>CREATE TABLE `mos_hello_world` ( `id` INT NOT NULL AUTO_INCREMENT, `text` TEXT NOT NULL, `published` TINYINT(1) NOT NULL, PRIMARY KEY (`id`) ) </query> </queries> </install> The database queries that need to be run to properly setup te component. Creates 1 table with 3 fields. For any easy way to figure what to put here, create your table in phpMyAdmin and it will tell you the code to use. <uninstall> <queries> <query>DROP TABLE IF EXISTS `mos_hello_world`;</query> </queries> </uninstall> Any database queries to run when uninstalling the component. This simply deletes the database table. <installfile> <filename>install.hello_world.php</filename> </installfile> <uninstallfile> <filename>uninstall.hello_world.php</filename> </uninstallfile> Points to files with additional code for installing and uninstalling the component. <administration> Everything after this point will be installed in the administrative end. <menu>Hello World</menu> This is what will be displayed in the "Components" drop-down menu. <submenu> <menu act="all">Show Text</menu> </submenu> This is the pop-out menu below your main menu. This also tells Mambo what function to run within your component. <files> <filename>admin.hello_world.php</filename> <filename>admin.hello_world.html.php</filename> <filename>class.hello_world.php</filename> <filename>toolbar.hello_world.php</filename> <filename>toolbar.hello_world.html.php</filename> </files> All of the files that are to be installed into administrator/components/com_hello_world/. </administration> </mosinstall> Closes out the Mambo install.
|