Overview
This page gives users further information on the Multi-like feature. This feature allows configurators to set multiple "like" options rather than just a simple "Like" button.
For a simple "Like" feature, you can make use of the PluginLike
FAQs
What does this Multi-Like feature do?
- The idea behind multi-like is to be able to expand on the like functionality to allow users to provide more qualitative feedback to the system.
- Rather than just allowing users to like/unlike things, multi-like allows users to select from a preset set of values. Multi-like also allows admins to provide numeric values to those selected options to provide a score for individual selections.
- Multi-value can be used on any Tiki object (article, forum, blog, trackeritem, etc)
Are there any limitations to this feature?
- Multi-like is not yet a mature feature and has its limitations. It works but hasn’t been refined as of yet.
- Visually, it still needs some work to make it look good. It can be templated over though in themes as well.
- It also has yet to be incorporated into the core Tiki templates for forums, articles, blogs, etc. The idea was to hold off on doing that until it’s matured and we see if this is a feature that the community will want built-in.
Is it complicated to use? Are there any knowledge pre-requisites?
At this stage, Multi-like is not a particularly complicated feature but requires some knowledge of Smarty templates, Smarty functions, and how the Tiki file structure is set up to use properly.
Configuration
Multi-like configuration requires accessing the “Community” Control Panel with the “Advanced” feature on. Look for the preference titled "Configuration for multilike". Note that every configuration must be separated by a blank line.
Options | Description | Example |
relation_prefix | This is the prefix used for the relation. Should be a two-part string, separated by a period and no spaces. | tiki.multilike1 |
ids | These are the ids for the various options. These are mandatory. | good,great,excellent |
labels | These are the various labels for the options from which users can choose. These should be comma separated values | This was good,I thought this was great, Really excellent! |
values | (Optional) You can set these to assign numerical values to the respective labels. These should be comma separated numbers, and the values count should equal the labels count. | 1,3,5 |
allow_multi | (Optional) Sets whether you should be able to select multiple labels (like checkboxes). This should be set to 'y' if you want use 'checkbox' functionality. Otherwise it functions like radio buttons. | y (default: n) |
icon_unselected | Since Tiki19, the name of the icon that will be use when no click has been recorded yet. By default it display a thumbs-up icon (outilned) | arrow-circle-up |
icon_selected | Since Tiki19, the name of the icon that will be use when a click or more has been recorded. By default it display a thumbs-up icon (plain) | arrow-circle-down |
Example value for configuration/preference field
relation_prefix=tiki.multilike1 ids=a,b,c values=1,3,5 labels=Good,Great,Excellent relation_prefix=tiki.multilike2 ids=a,b,c labels=Creative,Interesting,Factual allow_multi=y
This would initialize two possible multi-like configurations that could be used (note the blank line between the two configurations; this is required).
- The first would be “radio button”-styled and would let users select from Good, Great, and Excellent
- The first would be checkbox-styled and would let users select from Creative, Interesting, and Factual
Permission configuration
Until better permission handling is developed for Relations, tiki_p_post_comments will be used to check permissions.
Using a multi-like configuration in a Smarty template
Once multi-like is configured (see previous step), you may call it in a Smarty template using the "multilike" Smarty function. The parameters you must pass to this function are explained below:
Options | Description | Example |
relation_prefix | This is the prefix used for the relation as defined in the configuration. Should be a two-part string, separated by a period and no spaces. (Required) | tiki.multilike1 |
type | This is the type of object that is being rated/liked. (Required) | article |
object | This is the id of the object being liked. In most cases, you would likely assign a variable to this parameter. (Required) | $articleId |
onlyShowTotalPoints | If set to 'y' total number of points for object will be returned as an integer (Optional, 'n' by default) | onlyShowTotalPoints='y' |
onlyShowTotalLikes | If set to 'y' total number of likes for object will be returned as an integer (Optional, 'n' by default) | onlyShowTotalLikes='y' |
showOptionTotals | If set to 'y' each option will display their individual like counts next to label (Optional, 'n' by default) | showOptionTotals='y' |
showPoints | Toggle the display of total points for object (Optional, 'n' by default) | showPoints='y' |
showLikes | Toggle the display of likes for object (Optional, 'n' by default) | showLikes='y' |
choiceLabel | Provide a custom label for choices (Optional, default label is 'I found this:') | choiceLabel='This article was:' |
orientation | Set template orientation. Value can be either 'horizontal' or 'vertical'. (Optional, horizontal by default) | orientation='vertical' |
showInPopup | Set whether the options should be contained in a popup (optional, 'n' by default) | showInPopup="n" |
popupPlacement | Sets the placement of the popup (Optional, 'left' by default) | popupPlacement="top" |
Example Smarty code to call a multi-like configuration
{multilike relation_prefix="tiki.multilike1" type="wiki page" object=$page}
Example of a like / unlike usage
In this case we want to set 2 multilike plugins, one for like and one for unlike, using different icons (added in Tiki19).
Note: sonce Tiki19 we upgrade to font Awesome 5 and there is still work to be complete about outlined icons
In the multilike parameters text area;
relation_prefix=tiki.multilike1 ids=a values=1 labels=like icon_selected=thumbs-up icon_unselected=thumbs-o-up relation_prefix=tiki.multilike2 ids=a values=1 labels=don't like icon_selected=thumbs-down icon_unselected=thumbs-o-down
In a module;
{multilike relation_prefix="tiki.multilike1" type="wiki page" object=$page showOptionTotals='y' showLikes='n' choiceLabel=' '} {multilike relation_prefix="tiki.multilike2" type="wiki page" object=$page showOptionTotals='y' showLikes='n' choiceLabel=' '}