Yii 1.1: likedislike

Simple extension for putting like or dislike count to your yii application
12 followers

A simple yii extension to keep like dislike functionality

Requirements

  • Yii 1.1 or above
  • yii-user module
  • jquery.js
  • url without index.php and urlmanager enabled in config/main.php

INSTALLATION

  • Unzip
  • 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

Usage

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));
}

Resources

Total 5 comments

#14073 report it
hemc at 2013/07/17 09:05am
Tweaked to work with different models

Great extension, straight forward code.Thank you for your extension. As it is simple to work only to particular model, i tweaked it to work with different models. I used one more parameter to call widget and same for js code

<?php $this->widget('likedislike.widgets.LikeDislikeButton', array('post_id' => 5, 'post_type' => 'comment')); ?>

Can check modified code on Git

#12995 report it
pistonov at 2013/04/26 01:41pm
The CSRF token verifiecation.

How i can resolve error "The CSRF token could not be verified."?

#12939 report it
yiijco at 2013/04/22 05:14am
great extension...

yes...it cool extension..it work on postgresql ...thanks Ashok Poudel

#12168 report it
Ashok Poudel at 2013/03/03 11:43am
REPLY: Array to string conversion ?

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

 'application.modules.likedislike.models.*',

and yes, it works for comments. simply pass the "comment id" as 'field_id' parameter.

Thanks.

#12167 report it
sanguina at 2013/03/03 11:09am
Array to string conversion ?

what is this supposed to mean ?

'modules'=>array(
                 'likedislike',
                  ),

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'}

Leave a comment

Please to leave your comment.

Create extension