2012-03-06 3 views
0

表示するレポートのタイプに応じて値を検索し、特定のビューをレンダリングする検索コントローラがあります。奇妙なことが起こっている。 $ this-> renderを発行すると、レポートビューはレンダリングされません。CakePHP 2.0コントローラレンダリングが常に機能しない

パブリック関数admin_printReport(){

if (isset($this->request->data['Reports'])) { 

    $nons = $this->request->data['Reports']; 

    $res = array(); 

    // lets lookup the noncons.....  
    foreach ($nons as $dat=>$vdat) { 

     // skip the ones that are not checked 
     if ($vdat == 0) { 
      continue; 
     } 

     // this is the temporary array that holds all of the selected report numbers   >    $res[] = $dat; 

    } 

    $this->loadModel('Noncon');  
    $this->Noncon->recursion = 0; 
    $results = $this->Noncon->find('all', array('conditions'=>array('Noncon.id'=>$res))); 
    $this->set('results', $results); 

    // lets do the selection now... 
    if (isset($this->request->data['PS'])) { 
     // Print summary 
     $this->render('summary', 'print'); 
    } elseif (isset($this->request->data['PD'])) { 
     // Print detail 
     $this->render('detail', 'print'); 
    } elseif (isset($this->request->data['PDH'])) { 
     // Print detail with history 
     $this->render('detailhistory', 'print'); 
    } 
} 

// catch all if the render does not work.... 
$this->redirect(array('controller'=>'noncons', 'action'=>'search','admin'=>true)); 

}

任意のアイデアを次のように "キャッチは、すべての" ...コードを常にレンダリングされるラインをリダイレクト?

答えて

1

私はちょうどそれを見つけた....

各$ this->レンダリングのために、たとえば、

return $ this-> render( 'summary'、 'print');

0

同様の問題を追加しました。

コントローラにajax submitがあり、レンダリングを送信していませんでした。

$this->render($viewName, 'ajax'); 

リターンを使用しても助けになりませんでした。

コントローラ名がを追加で、自動レンダリングは自動的にビューをレンダリングするためのデフォルト(真であるので、それは必要ではなかったが、問題は、私はコントローラの終わりに

$this->render('add'); 

を追加したことでしたコントローラーの同じ名前)。

これは他の人に役立つことを願っています。

関連する問題