Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/cakephp/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cakephp 带过滤器和多视图的控制器_Cakephp_Model View Controller_Filtering - Fatal编程技术网

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