【问题标题】:Layout disappears for certain action in cake蛋糕中的某些动作布局消失
【发布时间】:2013-04-04 09:46:14
【问题描述】:

这在 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 数据的问题。让我知道您还需要我什么,因为我不太确定如何诊断/调试此问题。

谢谢

-安德鲁

【问题讨论】:

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


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多