Difference between revisions of "Customizing the listing detail page"

From JReviews Documentation
Jump to: navigation, search
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
+
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].
The listing detail page contains all information about a specific listing (custom fields, media items, reviews, etc.). Here is an [http://demo.reviewsforjoomla.com/products-catalog/laptops/apple-macbook-pro-154-laptop 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:
 
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>
 
*<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.
 
Before making any theme changes, read about [[JReviews Code Overrides]] and create a custom theme.
Line 17: Line 15:
 
<?php echo $this->element('listing_detail_media',array('position'=>'top','mainMedia'=>$mainMedia));?>
 
<?php echo $this->element('listing_detail_media',array('position'=>'top','mainMedia'=>$mainMedia));?>
 
</source>
 
</source>
 
  
  
Line 28: Line 25:
 
<?php echo $this->renderControllerView('reviews','user_reviews',array('listing'=>$listing))?>
 
<?php echo $this->renderControllerView('reviews','user_reviews',array('listing'=>$listing))?>
 
</source>
 
</source>
 +
  
 
loads a separate theme file which includes all code for user reviews:
 
loads a separate theme file which includes all code for user reviews:
Line 37: Line 35:
 
prx($listing);
 
prx($listing);
 
</source>
 
</source>
 +
  
 
Also, take a look at the [[Variables you can use in theme files|list of mostly used variables]]
 
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