编程开源技术交流,分享技术与知识

网站首页 > 开源技术 正文

php8.0.20下yaf框架(版本3.3.4)配置Smarty(版本4.3.4)

wxchong 2024-10-16 16:22:10 开源技术 77 ℃ 0 评论

本文是针对PHP版本为8.0.20.yaf框架版本3.3.4,Smarty版本为4.3.4环境的情况

下载Smarty后,需要将libs下面的内容copy到yaf项目的Smarty目录

yaf项目中对应的是

注意:在yaf项目的Bootstrap.php文件中需要include相关文件,如图:

在配置文件中需要注意将所有位置的目录都要做好创建

smarty.template_dir  =  XXXXX_PATH "/appvsm/views/"
smarty.compile_dir   =  "/data/www/cache/wx.xxxxx.cn/tplCompile/"
smarty.cache_dir = "/data/www/cache/wx.xxxxx.cn/tplCache/"
smarty.config_dir    =  XXXXX_PATH "/conf/"
smarty.left_delimiter = "<{"
smarty.right_delimiter = "}>"
smarty.cache_lifetime = 30
smarty.caching = false


注意Adapter.php文件在顶部需要增加引用

<?php
/*确保Smarty.class.php在Smarty/libs/下*/
Yaf_Loader::import( "Smarty/Smarty.class.php");   /*基类目录为library*/
class Smarty_Adapter implements Yaf_View_Interface   /*Smarty_Adapter类为yaf与smarty之间的适配器*/

其中Smarty/Smarty.class.php的Smarty是本地项目目录名,这个根据个人情况自行修改

Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表