Review & Rating
- From JLike v3.0.0 onwards we have introduced brand new Review & Rating feature deprecating the old one.
- This feature comes with the flexibility of defining multiple rating types for various content types (e.g. Article, Event, Course, Lesson).
- Also there are configurations for turning ON or OFF for every UI element of rating form-field along the ability to keep any field Mandatory or not as well
- By default DEFAULT_RATING type will be available with JLike installation. Admin can create any number of rating types.
How to integrate
- Import JlikeRatings class as JLoader::import("/components/com_jlike/includes/ratings", JPATH_SITE);
- Create object $JlikeRatings = new JlikeRatings;
- Call this function $JlikeRatings->display($element_id, $element, $url, $title = '', $ratingTypeCode = '');
- Above display() function's parameters:
- $element_id is jlike content id (jlike_content table)
- $element is jlike content element (jlike_content table)
- $url is jlike content URL (jlike_content table)
- $title is jlike content Title (jlike_content table)
- $ratingTypeCode is jLike rating type code (UNIQUE IDENTIFIER) (jlike_rating_types table). If left blank then, it will show DEFAULT_RATING rating type form
Sample code to integrate with DEFAULT_RATING rating type (For Joomla Article)
JLoader::import("/components/com_jlike/includes/ratings", JPATH_SITE);
$JlikeRatings = new JlikeRatings;
$articleLink = ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language);
$JlikeRatings->display($this->item->id, 'com_content.article', $articleLink, $this->item->title);
Sample code to integrate with other rating types (For Joomla Article)
JLoader::import("/components/com_jlike/includes/ratings", JPATH_SITE);
$JlikeRatings = new JlikeRatings;
$articleLink = ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language);
$JlikeRatings->display($this->item->id, 'com_content.article', $articleLink, $this->item->title, 'ANY_OTHER_RATING_TYPE');