如何在Yii中使用NLSClientScript扩展?

时间:2013-09-22 16:00:44

标签: yii yii-extensions

如何使用扩展程序http://www.yiiframework.com/extension/nlsclientscript/

我试过了:

配置/ main.php:

'clientScript' => array( 
'class' => 'ext.NLSClientScript',

视图/布局/ main.php:

$cs = Yii::app()->getClientScript();
$systemJsPath = Yii::app()->getAssetManager()->publish(
     Yii::getPathOfAlias('system.web.js' ), false, -1, false );
$cs->registerScriptFile('jquery');
$cs->registerScriptFile( $systemJsPath . '/custom.js');
$cs->registerScriptFile( $systemJsPath . '/ext/plugins/jquery.form.js');

但它不起作用。 jQuery没有加载。

1 个答案:

答案 0 :(得分:0)

Jquery在Yii中被称为核心脚本,应该使用CClientScript::registerCoreScript进行注册。

在你的例子中:

$cs->registerCoreScript('jquery');

所有核心脚本的短名称列在YII_PATH/web/js/packages.php