Joomla Tutorials and Blog Posts

A Beginners Guide to Joomla Overrides

overrideMaking changes to Joomla's core files is often neccessary, but there's a right and a wrong way to do it.

The wrong way is to directly edit Joomla's files. If you do, you'll lose all your changes when you next update your site.

The right way is to use an override. In this post, we'll show you what overrides are and how you can use them to safely edit components, modules and languages.

An Introduction to Overrides

  • What? An override is a file or database entry that is loaded instead of the normal core file.
  • Where? In Joomla, overrides are nearly always placed inside your template's files.
  • Who? Almost every template designer uses them. If you buy a template or download a free template, there is 99% chance that it will use overrides to help in designing your site.
  • How? Read on and find out how to override modules, components and languages.

1) Module Overrides

Here's the Login Form module we're going to modify in this example. We're going to remove the Remember Me button.

media_1352854676102.png
  • Login to your site's files and browser to the /modules/ folder.
  • Look for the /mod_login/ folder.
  • Inside the /mod_login/ folder, you'll hopefully find a /tmpl/ folder. If there isn't, your module won't support overrides.
  • Inside the /tmpl/ folder, look for the layout file for the module. In simple modules, it's often called default.php. Make a copy of this file.
media_1352854697496.png
  • Browse to your /templates/ folder.
  • Open the folder for your current template. In this example, our template is /beez_20/.
  • Open the /html/ folder.
  • Inside the /html/ folder, create a new folder with the same name as your original module's folder. In this case, that's /mod_login/.
  • Upload the layout file to this new folder.
media_1352855061081.png
  • You can now edit the layout file. In this example, comment out lines 49 to 54 from default.php.
  • Save the file and your change will be visible:
media_1352855088196.png

2) Component Overrides

Let's look at almost exactly the same task, but this time with a component. We're going to remove the Remember me box from our login component.

media_1352855342692.png
  • Login to your site's files and browser to the /components/ folder.
  • Look for the /com_users/ folder.
  • Inside the /com_users folder, you'll hopefully find a /views/ folder. If there isn't, your components won't support overrides.
  • Inside the /views/ folder, you may find several subfolders. Normally each one is logically named, according to the part of the component that they modify.
  • Look inside these folders and the /tmpl/ folders they contain . Look for the layout file you want to alter. In our example, the file is /login/tmpl/default_login.php.
media_1352855228398.png
  • Browse to your /templates/ folder.
  • Open the folder for your current template. In this example, our template is /beez_20/.
  • Open the /html/ folder.
  • Inside the /html/ folder, create a new folder with the same name as your original component's folder. In this case, that's /com_users/.
  • Create a subfolder inside /com_users/, matching the subfolder of the original component. In this case, that's /login/.
  • Upload the layout file to this new folder.
media_1352855484204.png
  • You can now edit the layout file. In this example, comment out lines 47 to 50 from default_login.php.
  • Save the file and your change will be visible:
media_1352855616789.png

3) Language Overrides

Whereas modules and components need to be overriden via the files, you can override language on your site via the Joomla administrator.

In this example, we're going to override "Don't have an account?"

media_1352855803827.png
  • Go to Extensions > Language Manager > Overrides.
  • Click New.
  • Enter "Don't have an account?" and click Search.
  • You'll see the results below the search box. Click the one you want to override.
media_1352855762827.png
  • Enter your new phrase into the Text box.
media_1352855888693.png
  • Click Save & Close.
  • You'll see the override listed as below:
media_1352855866334.png
  • Visit the front of your site and you'll see that override is now working:
media_1352855911113.png 

Comments

 
maluc21
#1 maluc21 2012-11-14 16:46

Great examples, didn“t know how to do this things and now I am clear for what route to take. Thanks, as always only usseful posts
 
 
E Mouawad
#2 E Mouawad 2012-11-15 02:17

Excellent explanation . THANK YOU.
Q- how to change a module in two or more different ways. i.e. got a form module that has different fields in various positions.
 
 
Dmitry
#3 Dmitry 2012-11-30 22:41

Great as always ;) Here is full and qualitative transaltion to Russian:
joomlablog.ru/.../...
 
 
Martin
#4 Martin 2013-05-02 01:27

Thanks for this great template override tutorial.

Quick question - is it still relevant for Joomla 3.1x

and can you apply these override principals to the Admin template ?

Thanks Martin
 
 
Jack Smith
#5 Jack Smith 2013-06-11 20:42

...and how to manage template specific language overrides for components ?
 

Add comment


Security code
Refresh

blog-ad

Start Online Training

Members get access to all our video training. That's 1,244 training sessions in Joomla, Drupal, WordPress and Coding.

Latest Comments

The License for Our Tutorials

All of our tutorials are published under the Creative Commons Attribution-NonCommercial license. This means:

  • You can re-use these tutorials.
  • You can modify these tutorials.
  • You must link back to our original tutorial.
  • You can't use these tutorials commercially.

Click here to read the full license.

Copyright 2013 Open Source Training, LLC. All rights reserved.