YII安装smarty-view-renderer扩展

smarty-view-renderer

 
 
**** ****** ****** **安装使用说明 * ****** ****** *****
 
1. 将压缩包解压内容至\protected\extensions\smarty\文件夹下
2. 需要在config/main.php的components中配置以下组件信息:
 
            //smarty-view-renderer 扩展组件
            'viewRenderer'=>array(
                'class'=>'application.extensions.smarty.ESmartyViewRenderer',
                'fileExtension' => '.tpl',
            ),
 
======================================
在Controller使用时调用方法:

Posted 31 October 2010 - 09:00 AM

You should do it the same way as with native Yii templates:
classMyControllerextendsCController{
 
function actionIndex(){
    $this
->render('index', array(
     
'variable'=>'value'
   
));
 
}
}
 
 
======================================

Installation,官方安装说明

  • Extract the release file under vendor/Smarty.
  • Download and extract libs folder contents of Smarty package under protected/vendor/Smarty.
  • Move files from plugins folder to protected/vendor/Smarty/plugins.
  • Add the following to your config file 'components' section:
<?php

// ...

'viewRenderer'=>array(

  'class'=>'application.ventor.Smarty.ESmartyViewRenderer',

    'fileExtension' => '.tpl',

    //'pluginsDir' => 'application.smartyPlugins',

    //'configDir' => 'application.smartyConfig',

    //'prefilters' => array(array('MyClass','filterMethod')),

    //'postfilters' => array(),

    //'config'=>array(

    //    'force_compile' => YII_DEBUG,

    //   ... any Smarty object parameter

    //)

),

There are some more options on configuring Smarty properties now. Will add documentation soon.

你可能感兴趣的:(smarty)