Difference between revisions of "How to display Description text in the Listings Module"

From JReviews Documentation
Jump to: navigation, search
 
Line 16: Line 16:
  
 
</source>
 
</source>
 +
  
 
and comment out the description line like this:
 
and comment out the description line like this:
Line 32: Line 33:
 
Next, edit the theme file of the listings module:
 
Next, edit the theme file of the listings module:
 
*<span style="color: blue">/com_jreviews/jreviews/views/themes/default/modules/listings.thtml</span>
 
*<span style="color: blue">/com_jreviews/jreviews/views/themes/default/modules/listings.thtml</span>
 +
  
 
To output the description text, paste this code into the file:
 
To output the description text, paste this code into the file:

Latest revision as of 16:25, 13 June 2011

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.