Re: pagination problem, please help
thank you Ivan,... I have tried that by the book,... and probably missed something on its way in a first place,...
well,... this is what I got now, and it's working,....
function category($id = null)
{
if($this->is_user())
{
$this->set('user_obj', $user = $this->User->findById($this->user['id']));
}
$filter = $this->params['pass'];
$this->set('url_options', $filter);
$category = $id;
$cat_id = array_search($category, Configure::read('Blog.blog_category'));
$this->set('category', $category);
$this->paginate = array('Blog' => array('conditions' => array('Blog.categories' => $cat_id), 'limit' => 12, 'recursive' => 1));
$blogs = $this->paginate('Blog');
$this->set('blogs', $blogs);
}
On Sunday, November 18, 2012 1:52:17 PM UTC-8, ivnrmc wrote:
i think this is your answer:function category($id = null){if($this->is_user()) {$this->set('user_obj', $user = $this->User->findById($this->user['id'])); }$category = $id;$cat_id = array_search($category, Configure::read('Blog.blog_category')); $this->paginate = array('Blog' => array('conditions' => array('Blog.categories' => $cat_id), 'limit' => 12, 'recursive' => -1));$blogs = $this->paginate('Blog');$this->set(compact('blogs', 'category'));}On Sun, Nov 18, 2012 at 9:05 PM, Chris <chri...@yahoo.com> wrote:hi guys,... I have a problem with pagination in a controller,... can someone help me please,...I'm getting an error: SQL Error: 1054: Unknown column 'limit' in 'where clause'how can I do this,...?function category($id = null){if($this->is_user()){$this->set('user_obj', $user = $this->User->findById($this->user['id'])); }$category = $id;$cat_id = array_search($category, Configure::read('Blog.blog_category')); $this->set('category', $category);$blogs = $this->Blog->find('all', array('conditions' => array('Blog.categories' => $cat_id)));$this->set('blogs', $blogs, $this->paginate('Blog', array('limit' => 12) ));thanks in advance,chris--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake...@googlegroups.com.
To unsubscribe from this group, send email to cake-php+u...@googlegroups.com .
Visit this group at http://groups.google.com/group/cake-php?hl=en .
--Ivan Rimacmail: ivn...@gmail.comtel: +385 95 555 99 66
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
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 cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home