別のモバイル ビューをロードしようとしていますが、問題が発生しています。モバイルレイアウトを機能させることはできますが、ビューはできません。
この質問を参考にして、cakephp 2.1 CakePHP ウェブサイト モバイル版を実行しています。
モバイル ビューを構成する方法がわかりません。
/app/View/name/mobile/view.ctp または /app/View/mobile/name/view.ctp または何か他のものですか。私はこれを理解しようとして円を描いてきました。助言がありますか。
私のAppController.php
フィルター前
パブリック関数 beforeFilter() {
/* モバイル レイアウトのテスト */
if ($this->request->isMobile()){
$this->is_mobile = true;
$this->set('is_mobile', true );
$this->autoRender = false;
} そうしないと {
$this->set('is_mobile', false );
}
}
After Filter (短縮)
関数 afterFilter() {
$view_file = file_exists(
"/var/www" .
$this->webroot .
"アプリ" 。DS。
'意見' 。DS。
$this->name . DS。
'モバイル/' 。
$this->action .
「.ctp」
);
$layout_file = file_exists(
"/var/www" .
$this->webroot .
"アプリ" 。DS。
'意見' 。DS。
「レイアウト」 . DS。
'モバイル/' 。
$this->layout .
「.ctp」
);
if($view_file || $layout_file){
$this->render(
$this->アクション、
($layout_file?'mobile/':'').$this->layout,
($view_file?'mobile/':'').$this->アクション
);
}
}