1

私は2つのビューファイルindex.ctpindexMobile.ctp. logincontroller.php両方の ctp ファイルに1 つのコントローラーと 1 つの関数を使用する必要があります。

4

2 に答える 2

1

特定のビューをレンダリングしたい場合は、コントローラーで $this->render を使用します

$this->render('your_view_file');

特定のビューのレンダリングを参照してください

于 2013-03-18T10:20:14.620 に答える
0

これが私の例です:

// Changing the "layout" (app/View/Layouts") if you want.
// Change this if you want a different layout for this view.
$this->layout='pdf';

// Folder where is the .ctp View file. 
// This is also optional, if your view is in some other folder.
$this->viewPath = 'Pdf';

// Call the "{$view}.ctp" in "Pdf" folder (app/View/Pdf/{$view}.ctp).
// Use this for choosing the right View.
$this->render($view);
于 2013-03-18T12:00:09.067 に答える