Difference between revisions of "How does the JReviews Theme Engine work"

From JReviews Documentation
Jump to: navigation, search
(Created page with 'JReviews uses a php templating system. This means you can mix html with php code, which provides a lot of flexibility to create conditionals and add snippets of php code. Locati…')
 
Line 1: Line 1:
 
JReviews uses a php templating system. This means you can mix html with php code, which provides a lot of flexibility to create conditionals and add snippets of php code.
 
JReviews uses a php templating system. This means you can mix html with php code, which provides a lot of flexibility to create conditionals and add snippets of php code.
  
Location of JReviews themes is in this folder: /components/com_jreviews/views/themes/ and the theme files have the .thtml extension.
+
JReviews themes are located in this folder: /components/com_jreviews/views/themes/ and the theme files have the .thtml extension.
  
 
In that folder you'll find several themes:
 
In that folder you'll find several themes:
*/components/com_jreviews/views/themes/default/
+
*/components/com_jreviews/views/themes/'''default'''/
*/components/com_jreviews/views/themes/default_02/
+
*/components/com_jreviews/views/themes/'''default_02'''/
*/components/com_jreviews/views/themes/default_dark/
+
*/components/com_jreviews/views/themes/'''default_dark'''/
  
  
You will notice that /default_02 and /default_dark theme folders contain much less files than the /default theme folder.
+
You will notice that '''/default_02''' and '''/default_dark''' theme folders contain much less files than the '''/default''' theme folder.
  
 
The /default folder contains all the theme, css and image files, while /default_02 and /default_dark are variations of the default theme and contain only "modified" files and images. Files that don't exist in those folders are used from the /default theme folder.
 
The /default folder contains all the theme, css and image files, while /default_02 and /default_dark are variations of the default theme and contain only "modified" files and images. Files that don't exist in those folders are used from the /default theme folder.
  
This is because the /default theme should always be intact to make JReviews upgrades easier. All theme modifications should be done in a separate folder (like default_02 and default_dark).
+
This is because the /default theme should always be intact to make JReviews upgrades easier.  
 +
If you want to modify theme files, you can create your own theme or copy the files you want to modify into "jreviews_overrides" folder.
  
  
 
== Creating your own theme ==
 
== Creating your own theme ==
 +
 
#Read the [[Default theme overview]] to learn the file structure
 
#Read the [[Default theme overview]] to learn the file structure
 
#Create a new folder for your theme
 
#Create a new folder for your theme
Line 26: Line 28:
  
  
Having all modified theme files in a separated folder simplifies JReviews upgrades. When new version of JReviews comes out with updated theme files, you can quickly update only the ones you modified.
+
== Modifying theme files ==
 +
 
 +
Creating your own theme is not necessary if you only want to modify several files from the default theme.
 +
 
 +
Instead, use the [[JReviews Code Overrides]] feature to create a copy of theme files you want to modify outside the /com_jreviews folder, and those files will be used instead of the ones in /themes/default folder.
 +
 
 +
For example, if you want to make modifications to the detail page theme file:
 +
*<span style="color: blue">/themes/default/listings/detail.thtml</span>
 +
 
 +
 
 +
Create a copy of the file into this folder:
 +
*<span style="color: blue">joomla_root/templates/jreviews_overrides/views/themes/default/listings/detail.thtml</span>
 +
 
 +
and then make the modifications.  
  
 +
Do the same for any other theme file.
  
With [[JReviews Code Overrides]] feature you can move your theme outside the com_jreviews folder, so you won't have to backup the theme when you upgrade JReviews.
+
After copying the files into /jreviews_overrides folder, you need to click on 'Clear File Registry' link in JReviews Administration.
  
  
 
[[Category:JReviews]]
 
[[Category:JReviews]]
 
[[Category:Themes]]
 
[[Category:Themes]]

Revision as of 23:30, 28 October 2009

JReviews uses a php templating system. This means you can mix html with php code, which provides a lot of flexibility to create conditionals and add snippets of php code.

JReviews themes are located in this folder: /components/com_jreviews/views/themes/ and the theme files have the .thtml extension.

In that folder you'll find several themes:

  • /components/com_jreviews/views/themes/default/
  • /components/com_jreviews/views/themes/default_02/
  • /components/com_jreviews/views/themes/default_dark/


You will notice that /default_02 and /default_dark theme folders contain much less files than the /default theme folder.

The /default folder contains all the theme, css and image files, while /default_02 and /default_dark are variations of the default theme and contain only "modified" files and images. Files that don't exist in those folders are used from the /default theme folder.

This is because the /default theme should always be intact to make JReviews upgrades easier. If you want to modify theme files, you can create your own theme or copy the files you want to modify into "jreviews_overrides" folder.


Creating your own theme

  1. Read the Default theme overview to learn the file structure
  2. Create a new folder for your theme
  3. 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
  4. Copy the /theme_css/images folder also
  5. Copy the files you want to modify into your theme folder (other files leave in the default theme folder)
  6. After your theme is done, to use it go to JReviews Configuration, tab 'General' and select it from the dropdown
  7. Important: For JReviews to recognize new files, you must click on 'Clear File Registry' link in JReviews Administration


Modifying theme files

Creating your own theme is not necessary if you only want to modify several files from the default theme.

Instead, use the JReviews Code Overrides feature to create a copy of theme files you want to modify outside the /com_jreviews folder, and those files will be used instead of the ones in /themes/default folder.

For example, if you want to make modifications to the detail page theme file:

  • /themes/default/listings/detail.thtml


Create a copy of the file into this folder:

  • joomla_root/templates/jreviews_overrides/views/themes/default/listings/detail.thtml

and then make the modifications.

Do the same for any other theme file.

After copying the files into /jreviews_overrides folder, you need to click on 'Clear File Registry' link in JReviews Administration.