Difference between revisions of "JReviews Code Overrides"
Line 18: | Line 18: | ||
*Create a theme folder inside the overrides folder: | *Create a theme folder inside the overrides folder: | ||
**<span style="color: blue">{site-root}/templates/jreviews_overrides/views/themes/'''mytheme'''</span> | **<span style="color: blue">{site-root}/templates/jreviews_overrides/views/themes/'''mytheme'''</span> | ||
+ | **even if you want to modify the theme files from the /default theme, it is better to create a custom theme name in the overrides | ||
+ | *copy the theme files that you want to modify from the /default theme and make sure you use the same folder structure, for example: | ||
+ | **if you want to modify the /themes/default'''/listings/detail.thtml''' file, create a copy like this: | ||
+ | ***<span style="color: blue">{site-root}/templates/jreviews_overrides/views/themes/mytheme'''/listings/detail.thtml'''</span> | ||
*Copy the /theme_images folder with all its images from the default theme folder into your theme, because they are always read from the currently theme and not from the default one | *Copy the /theme_images folder with all its images from the default theme folder into your theme, because they are always read from the currently theme and not from the default one | ||
*Copy the /theme_css/images folder also if you want to use the same images as the default theme | *Copy the /theme_css/images folder also if you want to use the same images as the default theme |
Revision as of 09:24, 20 August 2010
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:
- {site-root}/templates/jreviews_overrides = /components/com_jreviews/jreviews/
Modifying theme files in the overrides folder
- Read the Default theme overview to learn the file structure
- Create a theme folder inside the overrides folder:
- {site-root}/templates/jreviews_overrides/views/themes/mytheme
- even if you want to modify the theme files from the /default theme, it is better to create a custom theme name in the overrides
- copy the theme files that you want to modify from the /default theme and make sure you use the same folder structure, for example:
- if you want to modify the /themes/default/listings/detail.thtml file, create a copy like this:
- {site-root}/templates/jreviews_overrides/views/themes/mytheme/listings/detail.thtml
- if you want to modify the /themes/default/listings/detail.thtml file, create a copy like this:
- Copy the /theme_images folder with all its images from the default theme folder into your theme, because they are always read from the currently theme and not from the default one
- Copy the /theme_css/images folder also if you want to use the same images as the default theme
- Copy the files you want to modify into your theme folder (other files leave in the default theme folder)
- After your theme is done, to use it go to JReviews Configuration, tab 'General' and select it from the dropdown
- Important: For JReviews to recognize new files, you must click on 'Clear File Registry' link in JReviews Administration:
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.