2012-08-24 29 views
0

我有一個局部視圖如下:Yii的clientScript渲染引發Error

<?php 
Yii::app()->clientScript->registerPackage('nivo-slider'); 
Yii::app()->clientScript->render(); 

不過,我收到一個錯誤,說明Missing argument 1 for CClientScript::render(),

什麼參數不渲染方法需要?我檢查了文檔,但找不到任何明確的。

回答

1

They seem pretty clear to me。你需要傳遞一個引用變量來保存渲染字符串的值。

// as an example: 
$output = NULL; 
Yii::app()->clientScript->render($output); 
// you can now do something with output! 
+0

那麼,$ output是一個必需的變量嗎?由於我已經在上面的行中註冊了Package,所以$ output變量需要什麼值? – SidC

+0

沒關係。我在上面使用了NULL。 – cwallenpoole