Integrate PHPTAL template engine into yii framework

社会主义新天地 提交于 2019-12-11 11:15:23

问题


I'm wondering that how to integrate PHPTAL into yii framework? I'm using PHPTAL for a long time and it's nice template engine. Although Yii allows integrate another template engine into framework but it still does not support PHPTAL.

Thanks for your help.


回答1:


Have a look at this extension for Smarty template engine: smarty-view-renderer

Basically, you write a Component for Yii that implements IViewRenderer. Then override init() and implement renderFile(), and then in your main.php config file, you set viewRenderer to your Component class. Something like this:

'components' => array(
    ...
    'viewRenderer'=>array(
        'class'=>'application.extensions.path.to.your.class',
        'fileExtension' => '.ext',  // file extension to be handled by PHPTAL
        //other configurations for your component
    ),

and it will work like a charm.

But if you don't insist on PHPTAL, Smarty is there ready for you.



来源:https://stackoverflow.com/questions/7170370/integrate-phptal-template-engine-into-yii-framework

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!