Hi CakePHP bakers!
Just read through the CakePHP manual and finished the blog-tutorial,
and everything works great.
Next step would be to add a counter to the posts. How many times a
post have been read...
Where should I put this code? The counter should only be updated
everytime a user clicks
the link, not everytime the post is shown (refresh etc).
So far I've made a populateCount function in the post model:
function populateCount($id)
{
$this->query("UPDATE posts SET post_views +'1' WHERE id='$id'");
}
..and in the posts_controller.php file:
function display($id, $url)
{
.....
$this->Post->populateCount($id);
.....
}
This works but the post_views is updated everytime the post is
refreshed or gets a direct request...
Silly newbie question with a simple solution?
In advance, thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [EMAIL PROTECTED]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---