How to display listing description on list pages

From JReviews Documentation
Revision as of 16:10, 13 June 2011 by Jreviews (Talk | contribs)

Jump to: navigation, search

List pages by default display only listing summary text (if enabled in configuration). For performance reasons, the description text isn't available to the list page theme files. To change that, edit this file:

  • /com_jreviews/jreviews/controllers/categories_controller.php


Find this code:

# Remove unnecessary fields from model query
$this->Listing->modelUnbind('Listing.fulltext AS `Listing.description`');


and comment the it out like this:

# Remove unnecessary fields from model query
# $this->Listing->modelUnbind('Listing.fulltext AS `Listing.description`');


Next, edit the theme file of the list page, depending which layout you use:

  • /com_jreviews/jreviews/views/themes/{your_theme}/listings/listings_blogview.thtml
  • /com_jreviews/jreviews/views/themes/{your_theme}/listings/listings_tableview.thtml


To output the description text, paste this code into the file:

<?php echo $listing['Listing']['description'];?>


You will most likely want to output the description text below the intro text, so find this comment and paste the code below it:

<!-- END INTROTEXT -->


If you want to truncate the text to show only certain number of description text words, use this code instead:

<?php echo $Text->truncateWords($listing['Listing']['description'],55);?>

Replace 55 with the number of words you want to show.