A simple yii extension to keep like dislike functionality
INSTALLATION
Copy the likedislike folder to protected/modules/
under config/main/
'modules'=>array(
'likedislike',
),and under import array in the config file, add
'application.modules.likedislike.models.*',
Import protected/modules/data/tbl_likedislike.sql
You are ready to go
To display like dislike in blog feeds
<?php $this->widget('likedislike.widgets.LikeDislikeButton',array('field_id'=>your filed/blog/post id*)) ?>*your filed/blog/post id : it should be the id of the item you want to be liked or disliked
foreach($model as $row){ echo $row->title.$row->post; $this->widget('likedislike.widgets.LikeDislikeButton',array('field_id'=>$row->id)); }
Total 5 comments
How i can resolve error "The CSRF token could not be verified."?
yes...it cool extension..it work on postgresql ...thanks Ashok Poudel
in the config file, under the return array, you might already have a 'modules' array for configuring 'user' module and others. add a new line 'likedislike' to that array. ... works for me.
and under import array in the config file, add
and yes, it works for comments. simply pass the "comment id" as 'field_id' parameter.
Thanks.
what is this supposed to mean ?
Are you sure this is what is to be added to main/config ? Adding this gives me an error 'Array to string conversion '
And i am trying to use this for liking and disliking comments ? Will it work there ? If i directly import the module, i get a fatal error:
Fatal error: Call to a member function defaultOnload() on a non-object in C:\xampp\htdocs\swd\protected\modules\likedislike\widgets\LikeDislikeButton.php on line 29
Any suggestions would be appreciated !
thanks for replying and for this extension
Update: Well this works great.. within module you just need to add the string 'likedislike' and not the complete thing as array {'likedislike'}
If this module only has a widget to use, why not turn it into an extension or application component. Modules should only be used when something is to be displayed.
Leave a comment
Please login to leave your comment.