Re: How do I / Do I use parameters to limit the number of returned records?
actually: paginate uses Model::find('all', $yourconditions); in $yourconditions you can pass all things like fields, conditions, limit, group, etc... -- Lep pozdrav, Tilen Majerle http://majerle.eu 2012/7/28 Mitchell, Kevin > Thank you, Chetan: > > That was helpful; I just had fun with it. What you shared led me to > investigate the Pagination page and I see I can use in the first array, in > addition to limit and conditions, other keys like: fields, order, page, > contain, joins, recursive -- similar to find(). > > Again, I do appreciate. > > Kevin > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: How do I / Do I use parameters to limit the number of returned records?
Thank you, Chetan: That was helpful; I just had fun with it. What you shared led me to investigate the Pagination page and I see I can use in the first array, in addition to limit and conditions, other keys like: fields, order, page, contain, joins, recursive -- similar to find(). Again, I do appreciate. Kevin -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: How do I / Do I use parameters to limit the number of returned records?
Hi Kevin You can do like this $this->paginate = array('limit' => 10, 'conditions'=>array('Topic.type'=>'BK')); $topics= $this->paginate('Topic'); On Saturday, 28 July 2012 01:16:01 UTC+5:30, Kevin Mitchell wrote: > > PS: I guess I should start by learning how to do this with find() rather > than paginate(). > > I have working ... > > public function index() { > $this->Topic->recursive = 0; > $conditions = array("Topic.type = 'Bk'"); > debugger::dump($this->Topic->find('all', array('conditions' => > $conditions))); die; > } > > So, my question becomes: how do I pass a value the value 'Bk' to > $conditions? > > ... and, how would this be different using paginate() instead of find(). > > Thank you! > Kevin > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: How do I / Do I use parameters to limit the number of returned records?
scs: Thank you! So. with your help, I now have working, using request->params and a url of /topics/index/Bk or /topics/index/PR, etc. ... public function index() { $this->Topic->recursive = 0; $type = $this->request->params['pass'][0]; $conditions = array("Topic.type" => $type); $this->set('topics', $this->paginate('Topic', array($conditions))); } ... but you're suggesting, much better, that I have a form rather than a url to pass my type value. That feels so good when something works! Thank you, again, scs. I do appreciate. Kevin -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: How do I / Do I use parameters to limit the number of returned records?
to use conditions in paginate use something like this: public function index() { $this->Topic->recursive = 0; $conditions = array('type' => $this->request->data['Topic']['type']); $this->paginate(' Topic ', array($conditions)); } $this->request->data['Topic']['type'] is data coming from a form in your view. On Friday, July 27, 2012 3:46:01 PM UTC-4, Kevin Mitchell wrote: > > PS: I guess I should start by learning how to do this with find() rather > than paginate(). > > I have working ... > > public function index() { > $this->Topic->recursive = 0; > $conditions = array("Topic.type = 'Bk'"); > debugger::dump($this->Topic->find('all', array('conditions' => > $conditions))); die; > } > > So, my question becomes: how do I pass a value the value 'Bk' to > $conditions? > > ... and, how would this be different using paginate() instead of find(). > > Thank you! > Kevin > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: How do I / Do I use parameters to limit the number of returned records?
PS: I guess I should start by learning how to do this with find() rather than paginate(). I have working ... public function index() { $this->Topic->recursive = 0; $conditions = array("Topic.type = 'Bk'"); debugger::dump($this->Topic->find('all', array('conditions' => $conditions))); die; } So, my question becomes: how do I pass a value the value 'Bk' to $conditions? ... and, how would this be different using paginate() instead of find(). Thank you! Kevin -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
How do I / Do I use parameters to limit the number of returned records?
Hello -- and thank you for being willing to help. I'm new to PHP and CakePHP, but making progress. I have MVC setup for a table called topics. In the controller for public function index I have: $this->set('topics', $this->paginate()); That returns 15,000 records! I just want to see those of a certain type (in my case the sql would be WHERE type = 'BK'). What would I do next? I assume this has something to do with learning about parameters. Would I pass a parameter to the index page by doing something like: http://myapp/topics/index/type:PR -- where my type of topic is identified by 'BK' (i.e., type equals book)? If so, then what would this change the appearance of $this->set('topics', $this->paginate());? Thank you -- for either showing me how or telling me where to go in the documentation. Kevin -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php