我想知道如何将PHPTAL集成到yii框架中?我已经使用PHPTAL很长时间了,它是一个很好的模板引擎。虽然Yii允许在框架中集成另一个模板引擎,但它仍然不支持PHPTAL。
谢谢你的帮助。
发布于 2011-08-26 19:27:00
看一下Smarty template engine的这个扩展:smarty-view-renderer
基本上,您要为Yii编写一个实现IViewRenderer的组件。然后覆盖init()并实现renderFile(),然后在main.php配置文件中,将viewRenderer设置为组件类。如下所示:
'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
),它会像护身符一样起作用。
但是如果你不坚持使用PHPTAL,Smarty已经为你准备好了。
https://stackoverflow.com/questions/7170370
复制相似问题