How Joomla component manifest file works

While every extension in Joomla has a XML manifest file for installation, but one for components is the most sophisticated. Understanding how this file works and what you can do with it will save you headaches at installation time.

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!DOCTYPE install SYSTEM "">
  3. <install type="component" method="upgrade" version="2.5.0">
  4. <name>com_noidacity</name>
  5. <author>admin</author>
  6. <creationDate>April 2013</creationDate>
  7. <copyright>Copyright (C) 2013</copyright>
  8. <license>GNU General Public License version 2 or later</license>
  9. <authorEmail>prog.vimal(at)</authorEmail>
  10. <authorUrl></authorUrl>
  11. <version>1.0</version>
  12. <description>Adding, Editing contents related to Noida City</description>
  14. <languages folder="language/en-GB">
  15. <language tag="en-GB">en-GB.com_noidacity.ini</language>
  16. </languages>
  18. <files folder="components/com_noidacity">
  19. <filename>noidacity.php</filename>
  20. <filename>index.html</filename>
  21. </files>
  23. <install>
  24. <sql>
  25. <file charset="utf8" driver="mysql">install.mysql.sql</file>
  26. </sql>
  27. </install>
  28. <uninstall>
  29. <sql>
  30. <file charset="utf8" driver="mysql">uninstall.mysql.sql</file>
  31. </sql>
  32. </uninstall>
  34. <administration>
  35. <languages folder="administrator/language/en-GB">
  36. <language tag="en-GB">en-GB.com_noidacity.sys.ini</language>
  37. <language tag="en-GB">en-GB.com_noidacity.ini</language>
  38. </languages>
  39. <menu link="option=com_noidacity">COM_NOIDACITY</menu>
  40. <submenu>
  41. <menu link="option=com_noidacity&amp;view=places"
  43. <menu link="option=com_noidacity&amp;view=malls"
  45. </submenu>
  46. <files folder="administrator/components/com_noidacity">
  47. <filename>noidacity.php</filename>
  48. <filename>index.html</filename>
  49. <filename>install.mysql.sql</filename>
  50. <filename>manifest.xml</filename>
  51. <filename>uninstall.mysql.sql</filename>
  52. </files>
  53. </administration>
  54. </install>


Install Tag Manifest File In Joomla

So this manifest files and other XML file, it's starts off with an install tag and the install tag has three different parameters on it.

The first is its type to specify this installation file as one for a component. The next is the method which is upgrade. I recommend always using upgrade, because what it does is it installs the component if it's not already there. And if the component is already there it's simply copies the new files on top of the old ones. Then the final argument is the version number. This is the minimum Joomla version that this component will work on.

Name Tag in Joomla component manifest file

Just beneath the install tag are several tags that are used to identify the component. The most important one is the name tag. This one is currently set to com_noidacity and that's the exact same convention that you want to follow for your component. So always name the name with com_ the name of your component, The rest of the tags down on through description are more or less for information for the admins just to show who wrote it, when they wrote it, what license it's under, and what the component is for.

Language Tag in component xml file

The next tag underneath that is the languages tag. This one specifies the language file to be used for the front end of the Joomla Component.

Files Tag in Joomla XML File

Then just beneath that is a files tag. This tag specifies all the files that need to go into the components com_noidacity folder on installation. If you don't put the file here in this list, it will not get installed. You don't have to have a file name for every single file for instance if you have a folder, you can use a folder tag instead of file name, but you still do need to list the folders that you want to install.

Install and Uninstall Tags in Joomla

After the files tag are the install and uninstall tags. These are two optional tags, you don't have to put them in your component at all. However, if you do want to install some MySQL database tables on installation, this is a good place to do it.

Joomla Component sql files

So let's take a look at the files right now. I'm going to open the install.mysql file and you'll see there are several CREATE TABLE statements in here.

Install mysql joomla file

These contain not only the names of the tables, but also aliases for the tables. So you'll notice #__ at the beginning of the table names and that's simply an alias for the database prefix that you are using. In my installation here I have qw23_ as the database prefix.

Uninstall Sql Files in joomla

There is also an uninstall file. This file includes anything that you want to have happened when the component is uninstalled. Typically, you would want to drop the tables that you created during installation. However, this is optional. Many component developers decide not to do this, because they want to leave the data in the database in the event that someone has uninstalled the component, because they're having a problem with it and they just want to try re installing it. So it is up to you, you can have an uninstall file, or you can omit it.

Administrator tag in joomla

So after the install tags we've an administration tag. This almost looks like all the other tags that we've had so far just repeated again for the backend of the component. The first one is the languages tag and again these are just the language files that are going into the backend of the component rather than the one for the front end.

Menu and Submenu tags in joomla

Then next we have menu and submenu tags and these set up the menu in the backend where the component can be accessed.

Backend for menu and sub menu

Let's take a look in the backend right now and see what this generates. Now under the Components menu is Noida City and Noida City Places and Noida City Malls.You'll notice here in the XML file that the titles for the menu items are appearing as language strings. So these get translated by the language files that get installed in the tag before it.

Files tag for administrator joomla

And then finally we've another files tag. This installs all of the files into the backend of the component and notice that the manifest.xml file is also included in this file list. This is very important, because the manifest file needs to be present on installation and uninstallation.

Once you have a component manifest file under your belt, it serves as a good base for future components. Keep this manifest file handy for this component as well as for the next one you build.