Cakephp 带过滤器和多视图的控制器
在我的控制器中,我有两个功能Cakephp 带过滤器和多视图的控制器,cakephp,model-view-controller,filtering,Cakephp,Model View Controller,Filtering,在我的控制器中,我有两个功能index和archiv 在这两个函数中,我有相同的过滤条件集,但对于archiv函数,我使用索引视图。如何结合渲染功能设置条件。你对如何解决这个问题有什么建议吗 public function index() { ... $this->set('events', $this->Paginator->paginate($cond)); - 编辑:如果我复制view index.cpt,对$this->render进行注释,并取消对a
index
和archiv
在这两个函数中,我有相同的过滤条件集,但对于archiv函数,我使用索引视图。如何结合渲染功能设置条件。你对如何解决这个问题有什么建议吗
public function index() {
...
$this->set('events', $this->Paginator->paginate($cond));
-
编辑:如果我复制view index.cpt,对
$this->render
进行注释,并取消对archiv最后一行的注释,它可以正常工作,但我宁愿只保留一个视图,因为archiv
始终与index相同,在调用render函数之前,您应该设置变量:
public function archiv() {
...
// this should work now
$this->set('events', $this->Paginator->paginate($cond));
$this->render('index'); // reuse index view
什么蛋糕版本?
public function archiv() {
...
// this should work now
$this->set('events', $this->Paginator->paginate($cond));
$this->render('index'); // reuse index view