Yii Framework Forum: How To Create Like And Dislike - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How To Create Like And Dislike Rate Topic: -----

#1 User is offline   murugangm 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 78
  • Joined: 14-May 13

Posted 12 July 2013 - 12:51 AM

iam new in yii framework how to create like and dislike comment count and store database using ajax pls help anybody
0

#2 User is offline   codesutra 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 596
  • Joined: 15-March 11
  • Location:India

Posted 12 July 2013 - 01:13 AM

View Postmurugangm, on 12 July 2013 - 12:51 AM, said:

iam new in yii framework how to create like and dislike comment count and store database using ajax pls help anybody


Simply create a ajax link and pass parameters in it according to your specification. then in controller action save the data.
CodeSutra
0

#3 User is offline   codesutra 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 596
  • Joined: 15-March 11
  • Location:India

Posted 12 July 2013 - 01:18 AM

You can refer this link ;)

And i hope you are clear with the logic behind like dislike.
So you just need to create one action in controller file and pass parameter in it eg.
array('post_id'=>1,'status'=>'like')

and please change dislike link according the condition.
Then call this ajax link it will work. :)
CodeSutra
0

#4 User is offline   murugangm 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 78
  • Joined: 14-May 13

Posted 12 July 2013 - 03:51 AM

i want to onclick based display the values also how to at the same time display like count values in database
0

#5 User is offline   codesutra 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 596
  • Joined: 15-March 11
  • Location:India

Posted 12 July 2013 - 03:58 AM

View Postmurugangm, on 12 July 2013 - 03:51 AM, said:

i want to onclick based display the values also how to at the same time display like count values in database


YeAh this is what i am saying..refresh the div or something with ajax response after updating a result with new like or dislike..:)

from controller action return something like

return $likeCount;


or your can return json opbject like
$array = array('like_count'=>$likeCount,'dislike_count'=>$dislikeCount);
return CJSON::encode($array);


Then update your div with the ajax response.
CodeSutra
0

#6 User is offline   murugangm 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 78
  • Joined: 14-May 13

Posted 15 July 2013 - 02:09 AM

how to increase upcount or like count in database field values ,which condition pass in the controller please help
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users