The Art of Joomla is a free magazine about Joomla!(TM) 1.5 for users, web masters, designers and developers alike.

Artisan: a skilled worker who practices some trade or handicraft.

The Artisan's Directory is a free community directory for amateurs or professionals that can somehow help you get more out of your Joomla! website.

Sponsors

Banner
Banner
Google Groups
Joomla! User Group Brisbane
Visit this group
Banner
Home Magazine How Joomla! 1.5 Files are Organised
Issue 1

the Art of Joomla - Under the Hood

How Joomla! 1.5 Files are Organised

Written by Andrew Eddie

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:

/administrator
/cache
/components
/images
/includes
/installation
/language
/libraries
/logs
/media
/modules
/plugins
/templates
/tmp
/xmlrpc

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:

/com_content
/helpers
/models
/views
/article
/tmpl

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/.

/html
/com_content
/article
/mod_login

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.

(13 Votes)

6 Comments

  1. Valyo Gennoff makes this comment

    Very handy. Thanks a lot. I needed that.

    Sat 15 Dec 2007 22:24:30 CST

  2. Paul makes this comment

    My site is still under construction and has dragged on since july(they did not start until sep as I saw in the logs) I was supposed to be up and running nov7 for the realease of call of duty 4 as MWFs is a gaming community. They kept putting me off until the end and then they understood what I meant by the site needs to be built around the legues/ladders part of the site now I have to have this intergrated into my joomla site in the form of wrappers. I am making individual pages for each game and user profile page. They tell me that 1.5 is not stable. If so what would it affect? I have time to do an upgrade and I would have to do it because I know "they" would not. Do you see me and/or my staff having any major problems by going w/ J 1.5? Thanx for you help

    Tue 18 Dec 2007 15:26:55 CST

  3. Martin makes this comment

    Cool Info. Thanx a lot !

    Tue 18 Dec 2007 16:13:06 CST

  4. Edfel makes this comment

    Yes thanks for the information and for rokzine!

    Sat 29 Dec 2007 00:52:05 CST

  5. Pagchen makes this comment

    Articles like that are priceless. thanks

    Thu 03 Jan 2008 17:33:20 CST

  6. luky makes this comment

    ...and a very promising site ;) (voting doesn't seem to work, though) greets. luky

    Fri 18 Jan 2008 07:54:49 CST

Add a Comment