2017-07-18 103 views
0

我正在使用CakePHP 1.3。我想所有的HTML內容我的網頁(.ctp)與CSS和其它文件的PDF concatinate的(表,格..),CakePHP 1.3如何在顯示內容之前渲染視圖

我試圖用這樣的:

$view = new View(null, false); 
$view->set('timecard','masque'); 
$view->viewPath = 'pdf'; 
$output = $view->render('pdf', 'pdf'); 

OR

$view = new View($this, false); 
$view->set(compact('timecard', 'masque')); 
$html = $view->render('view_name'); 

感謝的幫助..

回答

0

請測試該代碼:

/* Make sure the controller doesn't auto render. */ 
$this->autoRender = false; 

/* Set up new view that won't enter the ClassRegistry */ 
$view = new View($this, false); 
$view->set('text', 'Hello World'); 
$view->viewPath = 'elements'; 

/* Grab output into variable without the view actually outputting! */ 
$view_output = $view->render('box');