Joomla! 1.5 Files Structure...

Joomla! 1.5 has many similarities to Joomla! 1.0 in terms of file structure and also many differences. In this article we will go over some of the major differences at a fairly high level.
When you unpack Joomla! the initial directories look like this:
There are a few things to note here:
  • The mambots directory has been renamed to plugins (this is one of the major terminology changes in Joomla! 1.5). The sub-directories format is still the same, where plugins are grouped into areas such as content, system, etc.
  • There is a new libraries directory. This houses much of the API and 3rd party libraries that was previously under /includes/.
  • There is a new /media/ directory which contain user-interface related files such as javascript libraries, flash files, etc.
  • The /help/ directory has been moved into the administrator area.
  • The legacy /editor/ directory has been removed.
  • There is a new /xmlrpc/ directory for the supporting web services via the XML-RPC protocol.
One of the most interesting directories to drill into is the /library/ directory. You will see many familiar names of third-party scripts such as /phpgacl/, /phpmailer/, /geshi/ and others. You will also see a some new ones like /simplepie/ and an interesting directory called /joomla/.

Virtually all of the core Joomla! API has been moved from a handful of files (namely /includes/joomla.php and others) into /libraries/joomla/. This is now the backbone of Joomla! Almost all classes reside in their own file in a logical hierarchy. For example, the database driver for mysql can be found in /libraries/joomla/database/database/mysql.php. As you browser through the many directories you will see unfamiliar names. Don't worry, we'll cover what's happening here in future articles.
There are two other main changes we want to cover that have the biggest impact on developers and designers.
The first major change is the restructure of the frontend components into an MVC format. The directory structure is generally something like this:
There are quite a few files in their as well but we'll go over them another time. The important thing at the moment is to understand the relationship of the directories to the Joomla! menu system and also the templating system. There might also be a /controllers/ directory depending on the complexity of the component (and the personal preference of the developer - see the sidebar for more notes on the MVC terminology).
Each directory under the /views/ directory is generally able to be called from the URL. For example index.php?option=com_content&view=article&id=1

We'll assume that the component knows what to do with the id, but this url will look in the /views/article/ folder for information about how to display this page. When you a new menu item in the administrator, you will see a list of component and when you select one, you will see all of the views listed. These are automatically picked up by the menu manager which is a major improvement over Joomla! 1.0 where these options were difficult to change. In many cases you will also see some more options to choose from and these are called layouts. The layouts reside in the the /views/view_name/tmpl/ directory and these are (mostly) the only place where HTML is displayed.

And this brings us to our second point. Joomla! 1.0 has a way of overriding the output of a component - but to be honest it's not well known and it was never really a solution that scaled well or survived upgrades to the core files. Joomla! 1.5 changes this. Because all the frontend components have their HTML in single layout files, Joomla! has gives you the ability to override those individual files in the active template.
To see an example of this have a look in the Beez template. You will see a new directory called /html/.
Both components and modules can have layout overrides.
In the case of components you make a directory tree starting with the component name (the same as what is found under the /components/ directory), the the name of the view directory,and finally you include a php file with the same name as the layout file you want to override.
Modules are the same except they don't have views, just the layout override (some third party developers do allow for different layouts in modules which is a pretty cool feature).
All you need to remember is to match the component or module name, matched the view name for components, then match the file name of the layout. It's pretty simple really. We'll go into more detail another time about exactly how views and layout tick.
Joomla! 1.5 Files Structure... Joomla! 1.5 Files Structure... Reviewed by Web Technology Funda on 11:18:00 PM Rating: 5

No comments

Free! Free!Free! Subscribe to Get Free PHP (Magento) tutorial Update in Your Inbox!!! Hurry Up!!!