How to add custom fields into JReviews RSS Feeds

From JReviews Documentation
Jump to: navigation, search

Customizing the Listings RSS Feed

To add a custom field into Listings RSS feed, edit this file:

  • /com_jreviews/jreviews/views/themes/default/feeds/listings.rss2.thtml


Find the item description tag:

<description>
<![CDATA[
<?php if($this->Config->rss_item_images && !empty($listing['Listing']['images'])):?>
<?php echo $Thumbnail->thumb($listing, 0, array('tn_mode'=>$this->Config->list_thumb_mode,'location'=>'list','dimensions'=>array($this->Config->list_image_resize),'align'=>$this->Config->rss_item_image_align));?>
<?php endif;?>
<?php echo $Text->truncateWords($listing['Listing']['summary'],$this->Config->list_abstract_trim);?>
]]>
</description>


and paste the field output code inside it (i.e. below summary code).

The code for custom fields that you can use is:

Outputs the field label

<?php echo $CustomFields->label('jr_fieldname',$listing); ?>

Outputs the field value

<?php echo $CustomFields->field('jr_fieldname',$listing); ?>


More info is available in How to customize the layout of custom fields in Theme files.


Important: After you make modifications to the rss theme file, to see the changes first you need to delete the cached rss feed xml file in this folder:

  • {joomla_root}/cache


Customizing the Reviews RSS Feed

To add a review custom field into Reviews RSS feed, edit this file:

  • /com_jreviews/jreviews/views/themes/default/feeds/reviews.rss2.thtml


Find the item description tag:

<description>
<![CDATA[
<?php if($this->Config->rss_item_images && !empty($review['Listing']['images'])):?>
<?php echo $Thumbnail->thumb($review, 0, array('tn_mode'=>$this->Config->list_thumb_mode,'location'=>'list','dimensions'=>array($this->Config->list_image_resize),'align'=>$this->Config->rss_item_image_align));?>
<?php endif;?>
<?php echo $review['Review']['comments'];?>
]]>
</description>


and paste the review field output code inside it (i.e. below comments code).

The code for review custom fields that you can use is:

Outputs the field label

<?php echo $CustomFields->label('jr_fieldname',$review); ?>

Outputs the field value

<?php echo $CustomFields->field('jr_fieldname',$review); ?>