How to do Joomla template override?

  • Avinash
  • 0
  • Aug 31, 2010
  • Tutorial

There may be occasions where you want to change the way the Joomla extension (such as components, module whether from Joomla core or any third party extensions). Of course we can write extension from scratch but it will be time consuming for anyone. Thankfully there is another way of doing this in very easy manner.

The standard output from any Joomla! Module or Component can be overridden by adding code to the html directory of your template. It is also possible to override two aspects of core functionality: Module chrome, and pagination.

Getting Start with Joomla template override

If you are new to Joomla! Development, then it is probably easiest to start with an existing view, and try modifying it to get what you want. To do this, you should make a copy of the existing view in the html directory of your template, and then modify the copy.

The directory structure you need is:

TEMPLATE_NAME/html/EXTENSION_NAME/VIEW_NAME/FILE_NAME.php
TEMPLATE_NAME/html/EXTENSION_NAME/VIEW_NAME/FILE_NAME.php

For example, if you want to change the way that the ‘Article’ view displays a com_content article, then you should copy the file at

PATH_TO_JOOMLA/components/com_content/views/article/tmpl/default.php to TEMPLATE_NAME/html/com_content/article/default.php
PATH_TO_JOOMLA/components/com_content/views/article/tmpl/default.php
to
TEMPLATE_NAME/html/com_content/article/default.php

(Note the slight difference in directory structure)

Similarly, if you want to change how the mod_login Module is displayed, then you should copy

PATH_TO_JOOMLA/modules/mod_login/tmpl/default.php to TEMPLATE_NAME/html/mod_login/default.php
PATH_TO_JOOMLA/modules/mod_login/tmpl/default.php
to
TEMPLATE_NAME/html/mod_login/default.php

Joomla! Comes pre-packaged with a frontend template called Beez. Beez utilizes template overrides to produce a table-less layout for faster, smoother, and semantically correct markup. To see how it’s done, locate your Joomla! Installation’s template directory, and you’ll notice the Beez template. Inside the Beez template directory, you’ll find a directory named html

the entire directory structure is as follows:

/your_joomla/templates/Beez/html/
/your_joomla/templates/Beez/html/

Source : Joomla.org

Related Posts

Written by Avinash

Avinash Zala is leading various projects which deals with the various technology involved with the web. A combination of perfect technical and management skills. Avinash would like to chat with you and convert your imagination into the working system. You can get in touch with him on Facebook and Twitter.

View all posts by: