Adjusting the component's look and feel through template overrides

RSFeedback!'s default frontend design (and functionality) may not be suitable for all of our customers, as each Joomla! template has it's own, custom arrangement when it comes to layouts (and some users might actually need some additional functionality which cannot be found in the downloadable version).

This does not only apply to our own components, but for any Joomla! extension. Joomla! was designed having this into consideration, by including the template overrides feature. What this feature does, is allow you to override a component's / module's layout without altering the original files (in order to keep changes after future updates).

 
General implementation

As the name implies, template overrides need to be performed for a particular template. Assuming that your component's name is com_component, the file that controls the view you wish to alter is called your_view.php and the template's name is your_template, here's how you can create a template override for one of the component's views:

Basically, you will need to replicate, in the template's html folder, most of the folder structure found in the component's views folder, as in the following example:

the /components/com_component/views/component/tmpl/your_view.php file needs to be copied to:

templates/your_template/html/com_component/component/your_view.php

After doing so, you will be able to perform your modifications without worrying about losing your changes upon possible future updates.

RSFeedback!'s layout files

All of RSFeedback!'s frontend menu item layouts are being controlled by the following files:

  • The Feedbacks View menu item - components/com_rsfeedback/views/feedbacks/tmpl/default_items.php
  • The List Categories - components/com_rsfeedback/views/categories/tmpl/default.php
  • The Add Feedback menu item - /components/com_rsfeedback/views/category/tmpl/edit.php
  • The Single Feedback menu item - /components/com_rsfeedback/views/feedback/tmpl/default.php
  • The Add Feedback menu item - /components/com_rsfeedback/views/feedback/tmpl/edit.php
Additional Functionality Example

Let's say that you are using the Beez20 template (Joomla! 2.5) and you wish to display a 20-character preview of the feedbacks' texts in the Feedbacks View menu item. Please take the following steps in order to achieve this:

  • Create the following folder structure: /templates/beez_20/html/com_rsfeedback/feedbacks
  • Copy the /components/com_rsfeedback/views/feedbacks/tmpl/default_items.php file to the previously created folder
  • Edit the copied file and add the following code where you need to have the preview text displayed:
 
        <div>
          <?php 
          if (strlen($item->text)<20)
          $preview=$item->text;
          else $preview=substr($item->text,0,23).' ...</p>';
          echo($preview);
          ?>
        </div>
 

After doing so, simply refresh the page that displays the Feedbacks View menu item, the feedback text's preview should appear in your chosen location.


One person found this article helpful.


Was this article helpful?

Yes No
Sorry about that

You Should Also Read

RSFeedback! Configuration

Why should i use RSFeedback ?

Moderation