蛋糕中的某些动作的布局消失了

时间:2013-04-04 09:46:15

标签: layout view action cakephp-2.3 missing-template

这在5分钟前完全正常工作......我不能为我的生活弄清楚为什么会这样。基本上,我从一个页面开始,有一个布局(=='默认'),没有在控制器代码中我在哪里更改布局,事实上,在应用程序中我没有更改布局,但由于某种原因,我点击了这个名为'addQuestion'的动作,它渲染了没有布局的视图......

<?php

// medicalCasesController.php
public function addQuestion($caseId) {
    if ($this->request->is('post')) {
        $this->MedicalCase->Question->create();
        if ($this->MedicalCase->Question->saveAll($this->request->data)) {
            $this->request->data['Question']['id'] = $this->MedicalCase->Question->getLastInsertId();

            $this->MedicalCase->Question->Image->processData($this->request->data);

            $this->Session->setFlash(__('The question has been saved successfully.', true), 'flash/success');
            $this->redirect(array('action' => 'addAnother', $caseId));
        } else {
            $this->Session->setFlash(__('There was a problem saving the question.', true), 'flash/failure');
        }
    }
    $this->MedicalCase->id = $caseId;
    $this->MedicalCase->contain(array('Question'));
    $mc = $this->MedicalCase->read();

    $count = $this->MedicalCase->getQuestions('count') + 1;

    // mc, count, caseId
    $this->set(compact('mc', 'count', 'caseId'));
}

?>

请记住,在提交表单之前,我看到没有POST数据的问题。让我知道你还需要什么,因为我不太确定如何诊断/调试这个问题。

由于

-Andrew

1 个答案:

答案 0 :(得分:0)

想出来,隐藏的鸿沟中有一个错误。 傻我..