Difference between revisions of "How to display detailed ratings on list pages"

From JReviews Documentation
Jump to: navigation, search
Line 63: Line 63:
  
  
 
+
The same code will work in listings_blogview.thtml and listings_thumbview.thtml if you use those layouts, but it will require more layout customizations to make the detailed ratings look good.
  
  

Revision as of 00:11, 4 January 2010

It is possible to display detailed ratings on list pages (blogview, tableview, thumbview), but detailed ratings take a lot of space so you will need to modify the layout.


I will show you how to add detailed ratings on a tableview list page because it has more room then other views.


This is how the ratings look by default on tableview page:

ListRatings1.png


We will modify the code to display detailed ratings like on listing detail page.

Open this theme file:

  • \com_jreviews\jreviews\views\themes\{theme_name}\listings\listings_tableview.thtml


Find the code that starts with <!-- BEGIN RATINGS COLUMN -->

Replace it with this:

<!-- BEGIN RATINGS COLUMN -->
<td class="columnLast">
	<?php echo $this->element('detailed_ratings',array('review'=>$listing,'reviewType'=>'user'));?>
</td>
<!-- END RATINGS COLUMN -->


Now the detailed ratings are displayed like this:

ListRatings2.png


To display editor detailed ratings use this code:

<?php echo $this->element('detailed_ratings',array('review'=>$listing,'reviewType'=>'editor'));?>


Customizing the layout of detailed ratings for the list page

The code that generates the layout for detailed ratings is in:

  • \com_jreviews\jreviews\views\themes\default\elements\detailed_ratings.thtml


That file is used to display detailed ratings on the listing detail page, so if you want to modify the layout only for detailed ratings on list pages, copy that file and rename it to:

  • \com_jreviews\jreviews\views\themes\default\elements\detailed_ratings_list.thtml


When adding new files anywhere in JReviews folders you have to clear the File Registry in JReviews so it recognizes the files.


To call the new file in listings_tableview.thtml file use this code:

<?php echo $this->element('detailed_ratings_list',array('review'=>$listing,'reviewType'=>'user'));?>


The same code will work in listings_blogview.thtml and listings_thumbview.thtml if you use those layouts, but it will require more layout customizations to make the detailed ratings look good.