Monday, 26 January 2015 22:34


Edit Component and Module Template

1 1 1 1 1 1 1 1 1 1 Rating 90% (5 Votes)
Template View File

Very often, you need to customize how a certain component or module is displayed in Joomla. We will show show the best way to accomplish this without editing the original files.

Editing a Component's view

Let's say you want to change a little your contact page. In components/com_contact/views/contact/tmpl/ you can see the file default.php which is responsible for your main contact page format

You could simply edit this file, but that is not the best way because if you need to upgrade your joomla version or whatever component you are modifying, your changes could get overwriten

The best practice is to use your template's html folder... if you don't have one, just create it.

Template View Custom File
  • Make sure you have the folder: templates/your-template/html
  • Create a new folder: templates/your-template/html/com_contact
  • Create a new folder: templates/your-template/html/com_contact/contact which stands for the right view
  • Copy your target components/com_contact/views/contact/tmpl/default.php file to that location

Joomla will detect that file and use it instead of the original so can now write there your changes without touching the core files.

Editing a Module's view

Similarly, if you want to customize for example your Login module, just follow the following steps:

  • Find modules/mod_login/tmpl/default.php
  • Create a new folder: templates/your-template/html/mod_login
  • Copy your target file to that location

And you'll be ready to change your Login module from there