0

这在 5 分钟前工作得非常好......我一生都无法弄清楚为什么会发生这种情况。基本上,我从一个页面开始,有一个布局(=='default'),在控制器代码中我没有更改布局,事实上,我没有在应用程序中更改布局,但是由于某种原因,当我点击了这个名为“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 数据的问题。让我知道您还需要我什么,因为我不太确定如何诊断/调试此问题。

谢谢

-安德鲁

4

1 回答 1

0

想通了,隐藏的鸿沟有错误。傻我..

于 2013-04-05T04:31:15.303 回答