Generate new page from list of articles and navigate - cakephp
I have a list of articles where I can select with a checkbox and I want to generate a page with a list of the selected articles. Then in this new page I wan开发者_运维问答t to navigate through those selected articles.
Should I save the ids of the selected articles in session in order to maintain them in the nmew generated page?
Is there a better way?
Thanks in advance
if you want the users to be able to come back to that list later on using url, then you need to put the ids in url. If you don't want them to do that, use Session is fine.
You could post the ID's through a form to a seperate (or the same) method and use the array of ID's in the condition of your $this->Model->find. Could look something like:
function list() {
$conditions = array();
if(isset($this->data)) {
$conditions = $this->data;
}
$this->set('results', $this->Model->find('all', array('conditions' =>$options)));
}
精彩评论