A
A
Anton2015-07-30 08:15:52
Kohana
Anton, 2015-07-30 08:15:52

Comment rating, who put it? how to rate comments for kohana?

Hello kohana version 3.1 how to implement user comment evaluation.
Here is an example of how I would like to implement.
The main thing is that you can click once so that the IP address is taken into account.
156b4ef48cee.jpg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Valentine, 2015-08-06
@gephaest

Create a table in the database, for example comment_likes with fields id, comment_id (key to comments), ip, value (like design).
When rendering the page, you need to get all the values ​​for each comment and calculate the score. It will probably work slowly with large volumes, you can denormalize the table with comments by adding a field with a like counter, you need to test it.
When a user likes, query this table to see if it has already been liked, like this:
But note that the IP cannot be the exact user ID.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question