There are many competing requirements for web designers ranging from accessibility to legislative to personal preferences.  Rather than trying to over-parameterise views, or trying to aim for some sort of line of best fit, or worse, sticking its head in the sand, Joomla! has added the potential for the designer to take over control of virtually all of the output that is generated.

Joomla! has generally been labeled by some for not giving due attention to accessibility or being archaic in their approach to web standards.  However with 1.5, the responsibility, but more importantly the power is back in the designer's hands.

In addition, except for files that are provided in the Joomla! distribution itself, these methods for customisation eliminate the need for designers and developers to "hack" core files that could change when the site is updated to a new version.  Because they are contained within the template, they can be deployed to the Web site without having to worry about changes being accidentally overwritten when your System Administrator upgrades the site.

The aim of this tutorial is to introduce the how four areas of the output of Joomla! are able to be customised by the template designer.

Not interested in all the theory? Visit You can get proffessional Joomla website.

MVC 101

MVC can be a scary acronym.  It stands for Model-View-Controller and the concepts behind MVC are responsible for the extra flexibility that is now afforded to the designer.  While parts of the theory can be rather involved and complicated, the only part that the designer need worry about is the V for View.  This is the part that is concerned with output.

Different extensions display output in different ways.

Components, as you would already know, are fairly complex and have the ability to display different information in different ways.  For example, the Articles Component (com_content) is able to display a single article, or articles in a category, or categories in a section.  Each of the ways of representing the different types of data (an article, or a category, or a section) is called a "view" (this comes from our MVC terminology).  Most components will have many views.  However, the view doesn't actually display the output.  This is left up to what we call a "layout" and it is possible for a view to have a variety of layouts.

The main thing to remember here is that components can have multiple views, and each view can have one or more layouts.  Each view assembles a fixed set of information, but each layout can display that information in different ways.  For example, the Category view in the Articles component assembles a number of articles.  These articles could be displayed in a list or in a table (and probably other ways as well).  So this view may have a "list" layout and a "table" layout to choose from.

Modules, on the other hand, are very simple.  They generally display one thing one way.  Modules don't really have views but they do support a layout.  Some developers might even support a choice of layout through module parameters

Template versus Layout

It is very important to distinguish between the role of template and the role of layouts.  The template sets up a structural framework for the page of the Web site.  Within this framework are positions for modules and a component to display.  What actually gets displayed is governed by the module layout, or the combination of view and layout in the case of the component.

The following image shows the structural layout of a typical Joomla! template (rhuk_milkyway, the default for 1.5).  The module positions are displayed by adding tp=1 to the URL (eg, index.php?tp=1).  You can clearly see where the module output is contained within the overall template, as well as the main component output starting in the lower-centre region.  However, what is actually output in those regions, is controlled by the layouts.

Ancillary Customisation

While not strictly related to the MVC, there are two other important areas to consider when looking at customising the output of Joomla!.

In addition to layouts, modules have what we call "chrome".  Chrome is the style with which a module is to display.  Most developers, designers and probably some end-users will be familiar with the different built-in styles for modules (raw, xhtml, etc).  It is also possible to define your own chrome styles for modules depending on the designer result.  For example, you could design a chrome to display all the modules in a particular position in a fancy javascript collapsing blind arrangement.

In the screenshot above, you can just make out the names of some of the built-in module chrome used (rounded, none and xhtml).

The second area has to do with controlling the pagination controls when viewing lists of data.  We will look at that in more detail later.

Component Output Types and Layout Overrides

To understand layout overrides we must first understand the file structure of a component.  While there are many parts to a component, all fulfilling different roles and responsibilities, we want to look just in the /view/ directory.  Here is the partial structure for two of the com_content views:






              default.php (this is a layout)

              form.php  (this is a layout)

            view.html.php (this is the view that outputs the HTML)

            view.pdf.php  (this is the view that outputs the PDF)



              blog.php     (layout)

              blog_items.php (a sub-layout

              default.php     (layout)

            view.html.php     (HTML view)

            view.feed.php     (RSS feed)

So what you see here is that under the /views/ directory, each view is placed in a directory of its own.  The content component actually has three other views not shown: archive, frontpage and section.

Output Types

Under the
/articles/ directory we have a number of files.  There is almost always a file called view.html.php.  This is what we call the view file, but there can be more than one depending on the type of output to produce.  It has a specific naming convention, view.output_type.php, where the output type can be html, feed, pdf, raw or error. What this means is when we want html output for this particular view, the view.html.php file is used.  When we want the RSS output, the view.feed.php file is used.

The affect of these different output types is most apparent when the Global Configuration setting for Search Engine Friendly URLs is set to Yes, Use Apache mod_rewrite is set to Yes, and Add suffix to URLs is also set to Yes.  When this is done, the site URLs will look something like this:


The exact URL will vary depending on how you set up your site but the point here is to show that sports.html will use the category view's
view.html.php file to, and that sports.feed will display the RSS feed for the category using view.feed.php.  It should be noted that you cannot currently customise feed or PDF output types.  However, you can customise the html output type and this is where layouts come into play.


Under the view directory there is a
/tmpl/ directory in which the layout files reside.  Each PHP file in this directory represents a layout.  For example, article/tmpl/default.php is the default layout for an article whereas article/tmpl/form.php is the edit form for an article; category/tmpl/default.php is the default layout for a category whereas category/tmpl/blog.php displays the list of article differently.

The relationship between component views and layout is most plainly seen when adding a new menu item.  The next screenshot represents the typical display of the New Menu Item page.  Having clicked on Articles (which represents
com_content), the tree expands to show the list of views and each layout within the view.

You will notice that while there are extra files in some of the
/tmpl/ directories (like pagebreak.php in the article view), they are missing from the list.  This is due to instructions in the XML file for the layout (for example, pagebreak.xml) to hide the layout (or even the view) from the menu item list.  However, this is another broad topic which will be covered in another tutorial.

Armed with all that knowledge of how all the parts relate to each other, we are now ready to actually create our layout overrides.

Copying or Creating layout Files

Layout overrides only work within the active template and are located under the /html/ directory in the template.  For example, the overrides for rhuk_milkyway are located under
/templates/rhuk_milkyway/html/, for the JA Purity template under /templates/ja_purity/html/ and for Beez under /templates/beez/html/.

It is important to understand that if you create overrides in one template, they will not be available in other templates.  For example, rhuk_milkyway has no component layout overrides at all.  When you use this template you are seeing the raw output from all components.  When you use the Beez template, almost every piece of component output is being controlled by the layout overrides in the template.  JA Purity is in between having overrides for some components and only some views of those components.

The layout overrides must be placed in particular way.  Using Beez as an example you will see the following structure:




        /com_content    (this directory matches the component directory name)

            /articles   (this directory matches the view directory name)

              default.php (this file matches the layout file name)


The structure for component overrides is quite simple: /html/com_component_name/view_name/layout_file_name.php.  Let's look at a few examples.

The rhuk_milkyway template does not have any layout overrides for any components.  If we want to override the default layout for an article, first we need to copy this file:


to this location, creating the appropriate directories in the event they don't already exist:


If we wanted to override the blog layout in the category view, we would copy this file:




Once the files are copied, you are free to customise these files as much or as little as required or desired.  You do not have to honour parameter settings if you don't want to.

Overriding Sub-layouts

In some views you will see that some of the layouts have a group of files that start with the same name.  The category and frontpage views have examples of this.  The blog layout in the category view actually has three parts: the main layout file
blog.php and two sub-layout files, blog_item.php and blog_links.php.  You can see where these sub-layouts are loaded in the blog.php file using the loadTemplate method, for example:

echo $this->loadTemplate('item');

// or

echo $this->loadTemplate('links');

When loading sub-layouts, the view already knows what layout you are in, so you don't have to provide the prefix (that is, you load just 'item', not 'blog_item').

What is important to note here is that it is possible to override just a sub-layout without copying the whole set of files.  For example, if you were happy with the Joomla! default output for the blog layout, but just wanted to customise the item sub-layout, you could just copy:



When Joomla! is parsing the view, it will automatically know to load blog.php from com_content natively and blog_item.php from your template overrides.

For further information, visit

Reasons why you must trust

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they're really offering you is nothing close to what ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.

You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

- DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.
- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.
- Data Center
ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization - as well as hardware failures. Our engineers are alerted to potential issues before they become critical.
- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.
- Security
Network security and the security of your server are ASPHostPortal's top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.
- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients' critical sites and services.