What nobody tells you about Joomla template overrides

Joomla is a very powerful CMS. Due to the features it comes with out-of-the-box it is specifically geared to web agencies, giving them the tool to create stunning websites for customers that checks all the boxes.

One of these features that make Joomla the goto CMS for web agencies is template overrides. But as some see template overrides as the Holy Grail, i see it as a work intensive feature that will leverage your maintenance (cost) on the site...

Some background information

Joomla follows the MVC pattern: Model View Controller pattern.

This ad is inserted via ochCall2Action and displayed via ochAddAds
Looks like Google ran out of ads to serve... or do you have an ad blocker activated?

By following this pattern, the functional logic of the website (in the model) is separated from the view, the controller is the 'glue' that binds the model and the view together.

Model–view–controller (usually known as MVC) is a software design pattern commonly used for developing User interface that divides the related program logic into three interconnected elements. This is done to separate internal representations of information from the ways information is presented to and accepted from the user. - wikipedia

The view uses a template file which is used to display the requested information on the webpage.

So when a visitor visits your blog post, the website router translates the URL and does a call to the com_content Controller. The controller forwards the request to the com_content article Model which updates com_content article View with the requested article data. The view then 'pushed' the article data into the templates article default.php file.

Every template has template files for the Joomla core components: com_content, com_contact, core modules, core plugins.

The template formats and displays the page.

What are template overrides?

In short: Template overrides give you the possibility to change the output of a component / module / plugin without changing the template or even Joomla Core files.

Form the official docs:

There may be occasions where you would like to change the way a Joomla! Extension (such as a Component or Module, whether from the Joomla! core or produced by a third party) is displayed on your site. Of course, you could recode the Extension from scratch, but that may be a bit ambitious for you! Thankfully, there is another way.

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.

 

To stick to our example: your blog post is displayed to the visitor via the template, but you want to change something so that it looks even better. lets say you want to add the articles intro image underneath the article title. So you go to the Joomla Facebook group, or any other gathering of Joomlers, and post your question. In every response you get is 'This can be done via a template override'!

So how does a template override work?

In the Template Manager you can create override files per component / module / plugin. When you choose to create an override for com_content, all com_content template files are copied into a html directory within the template.

Now when a visitor visits your site and the view 'pushes' the data to the template, the template will first look if a template override file is present for this component in the template html directory, if not it will use the template own file.

So when you change the template override created file in the html directory to have the article intro image below the title, that is what will be displayed to the visitor!

And the best part is that overrides 'survive' updates! when you update Joomla or even when you update your template, the created override files are not touched and remain intact!

Aren't there any downsides of template overrides?

As said, template overrides are a very powerful Joomla feature that are widely advised and used. But there is also a downside!

What nobody tells you when they advise you to do template overrides is that template overrides are potentially 'undermining' your well maintained and secure website with every change you make.

Everybody knows that not doing updates to your website is the same as leaving your door open and waiting for the bad guys to come in.

So everybody keeps their website up to date with the latest and greatest maintenance and security releases.

But....

As said, template overrides 'survive' any update of your website, template or component. That is because template overrides are copies of the template files. UNMAINTAINED copies I must add.

So when there is a security release of your template that fixes a vulnerability in the template file for com_content, then that security fix will NOT be implemented on your site. Your site is still using the copy of the template file without the fix! The same for any updated component, module or plugin!

The dangerous part is that you think that you are up to date and safe but in fact you aren't...

What people don't tell you when they advice you to do template overrides

Creating a template override is not a 'implement once, lay back and enjoy for ever' action.

Creating a template override means creating additional maintenance to your website: it requires with every update to your site you do that you do a (manual) check if template files have changed and if so implement (manually) these changes in your created override files.

That is a lot of work, especially because there are not that many extension and template developers who add this notice into their change log: so it is up to you and i can tell you from experience, it is hard and cumbersome work. But it needs to be done.

This ad is inserted via ochCall2Action and displayed via ochAddAds
Looks like Google ran out of ads to serve... or do you have an ad blocker activated?


Interesting blog? Like it on Facebook, Tweet it or share this article on other bookmarking websites.

Written by
Pro-Blogger Top Blogger Thought Leader

With a solid background in ICT (operational, tactical and strategic) and years of experience in the community life, I see in communities and community thinking the future for companies.

This future requires another way of thinking and doing; both for executives and employees. It's not about me; it's about you. Your well-being and your (personal) growth.

'What comes around - goes around'

In the world of communities, the old 'management laws' no longer work and are even counterproductive.

I coach leaders and organizations in their quest for how new and servant leadership can contribute to communities and community thinking, and as a result to the growth of the organization.

I do this from the following initiatives:

 


Discuss this article

INFO: You are posting the message as a 'Guest'

Log In or Sign Up

Forgot your password? / Forgot your username?