Re: Counting views of cached pages

2008-11-10 Thread Dave J
A that's a much cleaner solution I must say. Definately didn't know about that one. Good stuff. I agree with Simon though, you need to still be careful on what happens in the beforeFilters, especially if any of them make additional calls to the Models. On Nov 10, 8:55 am, "[EMAIL PROT

Re: Counting views of cached pages

2008-11-10 Thread [EMAIL PROTECTED]
Another, more cake based way of doing this, would be to use a beforeFilter, and set the (broadly undocumented at present): var $cacheAction = array('duration'=>'1 day','callbacks'=>true); in your controller. This will add calls to the before filter in your cached page. However, note that you'll

Re: Counting views of cached pages

2008-11-09 Thread Dave J
This may not be the cleanest solution, but here goes. It's a sort of 'web-bug' approach. You could have an action in your controller (or a separate controller dedicated to statistics) which will do the counting for you, and then invoke it with an tag in the view. So for example, you can have /a

Counting views of cached pages

2008-11-09 Thread Filip Camerman
In some controller actions I do an UPDATE table SET nviews = nviews + 1 WHERE id = '{$id}' to keep track of how often the page gets viewed (for each record). Now I want to cache some of these actions, and I was wondering what would be the best way to keep counting pageviews. The first way I can t