1 Introduction
Like module allows users to add like or dislike functionality to some content.
The like widget can be added to all content objects (except binary files). It shows a Like or Unlike button in the CMS page (depends if user liked this content before). It also shows a short list of users who recently liked the given content. The Like widget is linked to an unique content object ID (for example content123123).
2 Structure
Like module placed in folder <portal>/common/modules/like
Structure is the same as for other modules.
3 Like widgets
There is 1 widget:
- LikeWidget – shows button for liking/unliking content, list of newest likes and, if configured, list of older likes
3.1 LikeWidget
Invokes:
<?php $this->widget('like.widgets.LikeWidget', array('contentId'=>unique_content_id));?>
In this case unique_content_id is a unique content object ID. It must be unique per page. Widgets with same unique content object ID will not work correct on same html page.
Parameters:
- contentId – id of content.
- isPreview – if TRUE, widget will be displayed in preview mode. Preview mode is not recommended at common pages.
4 Preview mode
LikeWidget can be shown in preview mode, this means that no JavaScript or CSS will be shown. You can use the following urls to show LikeWidget in preview mode:
- <portal>/like/preview/?contentId=unique_content_id
In this case unique_content_id is a unique content object ID.
Parameters:
- contentId – id of content.