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

From JReviews Documentation
Jump to: navigation, search
(Created page with "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....")
 
Line 2: Line 2:
 
For performance reasons, the description text isn't available to the list page theme files.
 
For performance reasons, the description text isn't available to the list page theme files.
 
To change that, edit this file:
 
To change that, edit this file:
*/com_jreviews/jreviews/controllers/categories_controller.php
+
*<span style="color: blue">/com_jreviews/jreviews/controllers/categories_controller.php</span>
 +
 
  
 
Find this code:
 
Find this code:
Line 9: Line 10:
 
$this->Listing->modelUnbind('Listing.fulltext AS `Listing.description`');   
 
$this->Listing->modelUnbind('Listing.fulltext AS `Listing.description`');   
 
</source>  
 
</source>  
 +
  
 
and comment the it out like this:
 
and comment the it out like this:
Line 18: Line 20:
  
 
Next, edit the theme file of the list page, depending which layout you use:
 
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
+
*<span style="color: blue">/com_jreviews/jreviews/views/themes/{your_theme}/listings/listings_blogview.thtml</span>
*/com_jreviews/jreviews/views/themes/{your_theme}/listings/listings_tableview.thtml
+
*<span style="color: blue">/com_jreviews/jreviews/views/themes/{your_theme}/listings/listings_tableview.thtml</span>
 +
 
  
 
To output the description text, paste this code into the file:
 
To output the description text, paste this code into the file:
Line 25: Line 28:
 
<?php echo $listing['Listing']['description'];?>
 
<?php echo $listing['Listing']['description'];?>
 
</source>
 
</source>
 +
  
 
You will most likely want to output the description text below the intro text, so find this comment and paste the code below it:
 
You will most likely want to output the description text below the intro text, so find this comment and paste the code below it:
Line 30: Line 34:
 
<!-- END INTROTEXT -->
 
<!-- END INTROTEXT -->
 
</source>
 
</source>
 +
  
 
If you want to truncate the text to show only certain number of description text words, use this code instead:
 
If you want to truncate the text to show only certain number of description text words, use this code instead:
Line 37: Line 42:
  
 
Replace 55 with the number of words you want to show.
 
Replace 55 with the number of words you want to show.
 +
 +
 +
[[Category:JReviews]]
 +
[[Category:List Page]]
 +
[[Category:Themes]]

Revision as of 16:10, 13 June 2011

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.