JReviews Code Overrides

From JReviews Documentation
Revision as of 14:12, 5 September 2009 by Jreviews (Talk | contribs)

Jump to: navigation, search

JReviews' code override functionality allows you override any file located in the JReviews application folder at:

  • /components/com_jreviews/jreviews/

Why use the complete overrides functionality?

The most common way to upgrade a component in Joomla is to uninstall it and then re-install it. This means that any code changes you might have made to the core files of the components could be lost if you don't have a back-up; it is also more difficult to keep track of the files that you've customized. With the code override functionality you can place your customized files in a folder outside of the JReviews component to keep all your customizations in one place and safe from upgrade losses. Of course you still need to check for file differences when there's an upgrade, because there might be bug fixes in your modified files, but now you can easily keep track of which files to check.

How do I use this capability?

Easy! Just create a new folder in the templates folder of your Joomla installation called "jreviews_overrides". This folder matches the jreviews folder inside com_jreviews so that:

  • /templates/jreviews_overrides = /components/com_jreviews/jreviews/

The most basic example of something you should do when you start customizing your JReviews theme is to create a new theme folder in jreviews_overrides and put only the modified files there. Any time you create a new theme folder, you also need to copy the /theme_images folder from the original theme.

For more on theme customization read How does the JReviews Theme Engine work. Here's what the folder structure would look like:

  • /jreviews_overrides/views/themes/mytheme/...
  • /jreviews_overrides/views/themes/mytheme/theme_images/...

If you want to override a controller (i.e. listings_controller.php), then here's what it would look like:

  • /jreviews_overrides/controllers/listings_controllers.php

The framework will always check in the JReviews_overrides folder first to see if the file is there and if found it will use it instead of the core file.

Keep in mind that anytime you add a file to the overrides folder you need to clear the File Registry in the JReviews administration. Doing this allows JReviews to recognize the new file. Otherwise it will continue reading the file from the main component folder.