Joomla Overrides for Components, Modules and Languages

Joomla Overrides for Modules, Components and Languages

Making 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. Joomla 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. Joomla 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. Joomla 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(s) > 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 

This post has more details on Joomla language overrides.

For more information on overrides in general, check out the Best Tutorials on Joomla Template Overrides.