Hi guys,

I'm trying to get pagination working with filtering/conditions/where-
clause. Here's the solution I've got so far:

<?php
class ArticlesController extends AppController {

        var $name = 'Articles';
        var $scaffold;
        var $paginate = array(
                'limit' => 2,
                'order' => array('Article.created' => 'desc')
        );

        function index() {
                App::import('Sanitize');
                if(isset($this->passedArgs['filter'])) 
$this->paginate['conditions']
= Sanitize::clean($this->passedArgs['filter']);
                $articles = $this->paginate();
                $this->set(compact('articles'));
        }
}
?>

This lets you add something like /filter:article_category_id=5 to the
URL to filter the results, but when you click next, prev or a column
header, the filter gets removed. Is there anyway I can fix this? And
is this a safe method for production?

Thanks,
Mark

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to