Difference between revisions of "Customizing the listing detail page"

From JReviews Documentation
Jump to: navigation, search
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Theme file of the listing detail page is located here:
+
The listing detail page contains all information about a specific listing (custom fields, media items, reviews, etc.). Here is an [https://demo.jreviews.com/city-guide/hotels/boston-harbor-hotel example of a listing detail page on the demo site].
*<span style="color: blue">\com_jreviews\jreviews\views\themes\{theme_name}\listings\detail.thtml</span>
+
  
Before making any changes, read [[How does the JReviews Theme Engine work]] and copy the file to "jreviews_overrides" folder.
+
If you want to customize the layout of the listing detail page, this is where its default theme file is located:
 +
*<span style="color: blue">/com_jreviews/jreviews/views/themes/default/listings/detail.thtml</span>
  
 +
Before making any theme changes, read about [[JReviews Code Overrides]] and create a custom theme.
  
Almost every block of code in detail.thtml is commented and it shouldn't be a problem to find what you want to modify.
+
Almost every block of code in detail.thtml is commented to make it easier to find what you want to modify.
  
You can make any modifications below "EDIT HTML BELOW THIS LINE"
+
You can make any modifications below "EDIT HTML BELOW THIS LINE" comment.
  
 +
The detail.thtml theme file also includes some other theme files. For example, this line:
 +
 +
<source lang="php">
 +
<?php echo $this->element('listing_detail_media',array('position'=>'top','mainMedia'=>$mainMedia));?>
 +
</source>
 +
 +
 +
loads a separate theme file which includes all code for listing media items:
 +
*<span style="color: blue">/com_jreviews/jreviews/views/themes/default/elements/listing_detail_media.thtml</span>
 +
 +
This code:
 +
 +
<source lang="php">
 +
<?php echo $this->renderControllerView('reviews','user_reviews',array('listing'=>$listing))?>
 +
</source>
  
== Structure of the detail.thtml file ==
 
  
*<nowiki><div class="jr_pathway"></nowiki> - '''JReviews breadcrumbs'''
+
loads a separate theme file which includes all code for user reviews:
*<nowiki><h1 class="contentheading"></nowiki> - '''listing title and icons (new, featured, hot)'''
+
*<span style="color: blue">/com_jreviews/jreviews/views/themes/default/reviews/user_reviews.thtml</span>
*<nowiki><div class="contentInfoContainer"></nowiki> - '''author details, date, hits, favorite button, listing management, rss icons'''
+
*<nowiki><div class="itemImages"></nowiki>
+
**<nowiki><div class="itemMainImage"></nowiki> - '''main listing image'''
+
**<nowiki><div class="itemThumbnails"></nowiki> - '''thumbnails of other images'''
+
*<nowiki><table class="rating_table"></nowiki> - '''editor and user rating stars'''
+
*<nowiki><div class="jr_customFields"></nowiki> - '''listing custom fields, /elements/custom_fields.thtml file included'''
+
*<nowiki><div class="contentFulltext"></nowiki> - '''summary & description'''
+
*<nowiki><div id="jr_reviewEditorSummary"></nowiki> - '''editor reviews summary'''
+
*<nowiki><form class="jr_form jr_formContainer"></nowiki> - '''editor review submit form, /reviews/reviews.thtml file included'''
+
*<nowiki><div id="jr_reviewEditor"></nowiki> - '''editor reviews'''
+
*<nowiki><div id="jr_reviewUserSummary"></nowiki> - '''user reviews summary'''
+
*<nowiki><form class="jr_form jr_formContainer"></nowiki> - '''user review submit form, /reviews/reviews.thtml file included'''
+
*<nowiki><div id="jr_user_reviews"></nowiki> - '''user reviews, /reviews/reviews.thtml file included'''
+
  
 +
Most of the listing data is stored in the $listing array. To see the contents of this array, add this line to the detail.thtml:
  
To see what data you can use in detail.thtml file, uncomment this line:
 
 
<source lang="php">
 
<source lang="php">
prx($listing); // Listing array
+
prx($listing);
 
</source>
 
</source>
  
  
Or take a look at the list of mostly used [[Data you can use in detail.thtml theme file]]
+
Also, take a look at the [[Variables you can use in theme files|list of mostly used variables]]
  
  

Latest revision as of 19:11, 18 October 2019

The listing detail page contains all information about a specific listing (custom fields, media items, reviews, etc.). Here is an example of a listing detail page on the demo site.

If you want to customize the layout of the listing detail page, this is where its default theme file is located:

  • /com_jreviews/jreviews/views/themes/default/listings/detail.thtml

Before making any theme changes, read about JReviews Code Overrides and create a custom theme.

Almost every block of code in detail.thtml is commented to make it easier to find what you want to modify.

You can make any modifications below "EDIT HTML BELOW THIS LINE" comment.

The detail.thtml theme file also includes some other theme files. For example, this line:

<?php echo $this->element('listing_detail_media',array('position'=>'top','mainMedia'=>$mainMedia));?>


loads a separate theme file which includes all code for listing media items:

  • /com_jreviews/jreviews/views/themes/default/elements/listing_detail_media.thtml

This code:

<?php echo $this->renderControllerView('reviews','user_reviews',array('listing'=>$listing))?>


loads a separate theme file which includes all code for user reviews:

  • /com_jreviews/jreviews/views/themes/default/reviews/user_reviews.thtml

Most of the listing data is stored in the $listing array. To see the contents of this array, add this line to the detail.thtml:

prx($listing);


Also, take a look at the list of mostly used variables