How to display Description text in the Listings Module

From JReviews Documentation
Jump to: navigation, search

Listings Module by default displays only listing summary text (if enabled in module parameters). For performance reasons, the description text isn't available to the module theme files. To change that, edit this file:

  • /com_jreviews/jreviews/controllers/modules/module_listings_controller.php


Find this code:

// Remove unnecessary fields from model query
$this->Listing->modelUnbind(array(
    'Listing.fulltext AS `Listing.description`',
    'Listing.metakey AS `Listing.metakey`',
    'Listing.metadesc AS `Listing.metadesc`',
    'User.email AS `User.email`'                    
));


and comment out the description line like this:

// Remove unnecessary fields from model query
 $this->Listing->modelUnbind(array(
     // 'Listing.fulltext AS `Listing.description`',
     'Listing.metakey AS `Listing.metakey`',
     'Listing.metadesc AS `Listing.metadesc`',
     'User.email AS `User.email`'                    
 ));


Next, edit the theme file of the listings module:

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


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

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


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.