Difference between revisions of "How to display listing description on list pages"

From JReviews Documentation
Jump to: navigation, search
 
Line 1: Line 1:
 
List pages by default display only listing summary text (if enabled in configuration).
 
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:
 
*<span style="color: blue">/com_jreviews/jreviews/controllers/categories_controller.php</span>
 
  
 
+
Edit the theme file of the list page, depending which layout you use:
Find this code:
+
<source lang="php">
+
# Remove unnecessary fields from model query
+
$this->Listing->modelUnbind('Listing.fulltext AS `Listing.description`'); 
+
</source>
+
 
+
 
+
and comment the it out like this:
+
<source lang="php">
+
# Remove unnecessary fields from model query
+
# $this->Listing->modelUnbind('Listing.fulltext AS `Listing.description`'); 
+
</source>
+
 
+
 
+
Next, edit the theme file of the list page, depending which layout you use:
+
 
*<span style="color: blue">/com_jreviews/jreviews/views/themes/{your_theme}/listings/listings_blogview.thtml</span>
 
*<span style="color: blue">/com_jreviews/jreviews/views/themes/{your_theme}/listings/listings_blogview.thtml</span>
 +
*<span style="color: blue">/com_jreviews/jreviews/views/themes/{your_theme}/listings/listings_blogview_magazine.thtml</span>
 
*<span style="color: blue">/com_jreviews/jreviews/views/themes/{your_theme}/listings/listings_tableview.thtml</span>
 
*<span style="color: blue">/com_jreviews/jreviews/views/themes/{your_theme}/listings/listings_tableview.thtml</span>
  
 
+
Replace this variable that outputs only summary:
To output the description text, paste this code into the file:
+
 
<source lang="php">
 
<source lang="php">
<?php echo $listing['Listing']['description'];?>
+
$listing['Listing']['summary'];
 
</source>
 
</source>
  
 
+
with this variable that outputs only the 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:
+
 
<source lang="php">
 
<source lang="php">
<!-- END INTROTEXT -->
+
$listing['Listing']['description'];
 
</source>
 
</source>
  
 
+
or this variable that outputs both summary and description:
If you want to truncate the text to show only certain number of description text words, use this code instead:
+
 
<source lang="php">
 
<source lang="php">
<?php echo $Text->truncateWords($listing['Listing']['description'],55);?>
+
$listing['Listing']['text'];
 
</source>
 
</source>
  
Replace 55 with the number of words you want to show.
+
Make the replacements in all places in the theme file.
  
  

Latest revision as of 10:01, 12 November 2016

List pages by default display only listing summary text (if enabled in configuration).

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_blogview_magazine.thtml
  • /com_jreviews/jreviews/views/themes/{your_theme}/listings/listings_tableview.thtml

Replace this variable that outputs only summary:

$listing['Listing']['summary'];

with this variable that outputs only the description:

$listing['Listing']['description'];

or this variable that outputs both summary and description:

$listing['Listing']['text'];

Make the replacements in all places in the theme file.