Call Now
+1-908-873-6465
+44-20351-45403
Support

Template Overrides

The dynamic template gives you a great deal of control over the presentation of your site without requiring you to use multiple templates. The styles included in Twitter Bootstrap can be used as-is or overridden for custom presentation. However, the custom styling is often limited to the template itself leaving modules and components that retain the look and feel of the default Joomla experience. Joomla, however, provides a feature known as template overrides that let you customize all of the modules and components included with Joomla (and many third-party extensions) to match your template exactly.

 

Template overrides allow you to make small tweaks to existing modules and components instead of having to recreate the entire functionality. For example:

  • You might want to use the current login system, but you need the presentation to match the rest of your template in styling or semantic layout (and CSS changes won’t do)
  • You need to swap out the main menu module to have an integrated breadcrumb, but you want the rest of the system to use it without resetting all of the menus to the new module
  • You want to add a better search engine component, but you want to leave the main search module in place so it feeds directly to your new search engine.

There are generally five areas where a template override is needed :

  • Module override: The display of a module needs to be overridden to provide custom HTML layout, extra JavaScript code, or an alternate destination for the submission destination of a form.

  • Module chrome change: When you want to change certain display or “chrome” aspects of the module without completely replacing the view, you can use module chrome code that will inject particular aspects into the module code.

  • Creating a component override: All Joomla components are organized in the Model-View-Controller (MVC) structure, so all of the presentation logic for a component is stored in the views/ folder of the component. You can therefore override any of the presentation logic of any component.

  • Overriding a third-party component or module: You can override any third-party component or module that complies with the Joomla MVC structure of building extensions with the standard Joomla system. That means you can alter the display of popular components without modifying the extension’s code.

  • Special page overrides: There are special pages in the Joomla system, including the 404 page and the Offline page, that you can override with a template override.
With template overrides, you can store replacement views in the template directory and, if that template is selected for a page, the items will override the display of that extension. That means you can create a custom login box without rewriting or uninstalling the default module. Alternatively, you can include a new search component form or a custom mod_mainmenu without having to touch the original files.

Even better, all the template overrides are installed with your template, so you can use a single extension installation to place all these items on a site. You can essentially package an entire site presentation structure within a single file! Before you actually create a template override, it is useful to have an overview of the location of overrides within a template directory structure and how Joomla determines which override replaces which interface presentation. You can also see how these overrides are included in your template descriptor file.

Last modified on Monday, 31 August 2015 10:43