Performing template overrides

General Overview

Although RSDirectory! is complex enough to satisfy most of our customers' needs, certain scenarios might require some HTML and PHP modifications in the component's code. Modifying the code can be done easily, as none of our components are encrypted. However, doing so raises a big issue - losing the changes upon future updates.

Joomla! provides a solution for this problem, in the shape of template overrides.

Each of RSDirectory's menu items' layout is controlled by the following files:

  • \components\com_rsdirectory\views\categories\tmpl\default.php - The List Categories menu item.
  • \components\com_rsdirectory\views\credits\tmpl\default.php - The Buy Credits menu item.
  • \components\com_rsdirectory\views\entries\tmpl\default.php - The List Entries menu item.
  • \components\com_rsdirectory\views\entry\tmpl\default.php - The Single Entry menu item.
  • \components\com_rsdirectory\views\favorites\tmpl\default.php - The Favorites menu item.
  • \components\com_rsdirectory\views\list\tmpl\default.php - The Categories from Field Values menu item.
  • \components\com_rsdirectory\views\myaccount\tmpl\default_general.php - The My Account menu item - General tab.
  • \components\com_rsdirectory\views\myaccount\tmpl\default_credits_history.php - The My Account menu item. - Credits History tab
  • \components\com_rsdirectory\views\myaccount\tmpl\default_transactions.php - The My Account menu item - Transactions tab
  • \components\com_rsdirectory\views\transaction\tmpl\default.php - The My Account menu item - Transactions tab - single transaction view.
  • \components\com_rsdirectory\views\myentries\tmpl\default.php - The My Entries menu item.
  • \components\com_rsdirectory\views\radius\tmpl\default.php - The Map Radius Search menu item.
  • \components\com_rsdirectory\views\entry\tmpl\edit.php - The Add Entry menu item.

As explained in the article on Joomla! template overrides linked above, in order to not lose any modifications made to any layout file, you will need to almost completely replicate it's location's folder structure in your default frontend template's html folder, copy the file there and apply your modifications in the newly created copy:

\templates\your_default_template\html

 

Example

Let's assume that you wish to modify the way the Single Entry menu item is being displayed and that you are using the default Joomla! Protostar template. You will need to first copy the default.php file found in \components\com_rsdirectory\views\entry\tmpl\ to the following path:

\templates\protostar\html\com_rsdirectory\entry

then edit it and perform your modifications.

All of the displayed information is actually stored within PHP variables which usually contain more data than what is being displayed by default. You can work with these variables in order to customize the component's frontend layout and functionality.

As an example, if you wish to list all of the entry-related information available in the Single Entry menu item, simply add the following code anywhere in the default.php file:

<?php print_r($this->entry);die();?>

You can have a look at the Send an email to the entry's owner through an RSForm!Pro form example in RSDirectory!'s Frequently asked questions documentation section to better understand how this is implemented.

 

Template overrides for modules

The concept of template overrides is not limited to component pages, you can perform the same type of modifications, in a similar manner, for module layouts.

Let's say that you wish to modify the RSDirectory! Popular Entries module's layout. You will need to copy the following file:

\modules\mod_rsdirectory_popular_entries\tmpl\default.php

to the following location:

\templates\template_name\html\mod_rsdirectory_popular_entries

and edit the copy instead of the original file.

 

One person found this article helpful.


Was this article helpful?

Yes No
Sorry about that