好得很程序员自学网
  • 首页
  • 后端语言
    • C#
    • PHP
    • Python
    • java
    • Golang
    • ASP.NET
  • 前端开发
    • Angular
    • react框架
    • LayUi开发
    • javascript
    • HTML与HTML5
    • CSS与CSS3
    • jQuery
    • Bootstrap
    • NodeJS
    • Vue与小程序技术
    • Photoshop
  • 数据库技术
    • MSSQL
    • MYSQL
    • Redis
    • MongoDB
    • Oracle
    • PostgreSQL
    • Sqlite
    • 数据库基础
    • 数据库排错
  • CMS系统
    • HDHCMS
    • WordPress
    • Dedecms
    • PhpCms
    • 帝国CMS
    • ThinkPHP
    • Discuz
    • ZBlog
    • ECSHOP
  • 高手进阶
    • Android技术
    • 正则表达式
    • 数据结构与算法
  • 系统运维
    • Windows
    • apache
    • 服务器排错
    • 网站安全
    • nginx
    • linux系统
    • MacOS
  • 学习教程
    • 前端脚本教程
    • HTML与CSS 教程
    • 脚本语言教程
    • 数据库教程
    • 应用系统教程
  • 新技术
  • 编程导航
    • 区块链
    • IT资讯
    • 设计灵感
    • 建站资源
    • 开发团队
    • 程序社区
    • 图标图库
    • 图形动效
    • IDE环境
    • 在线工具
    • 调试测试
    • Node开发
    • 游戏框架
    • CSS库
    • Jquery插件
    • Js插件
    • Web框架
    • 移动端框架
    • 模块管理
    • 开发社区
    • 在线课堂
    • 框架类库
    • 项目托管
    • 云服务

当前位置:首页>后端语言>PHP
<tfoot draggable='sEl'></tfoot>

phpsmarty配置 phpstudy 配置

很多站长朋友们都不太清楚phpsmarty配置,今天小编就来给大家整理phpsmarty配置,希望对各位有所帮助,具体内容如下:

本文目录一览: 1、 php smarty前后台模板路径的配置问题 2、 php smarty 配置 3、 ThinkPHP3.2.3 配置smarty模板问题 4、 使用smarty需要修改php配置么 5、 thinkphp使用smarty模板后如何配置success和error跳转页面 php smarty前后台模板路径的配置问题

$smarty=new

smarty;

$smarty->template_dir=base_path.smarty_path."templates/";

$smarty->compile_dir=base_path.smarty_path."templates_c/";

$smarty->config_dir=base_path.smarty_path."configs/";

$smarty->cache_dir=base_path.smarty_path."cache/";

//定义定界符

$smarty->left_delimiter='<{';

$smarty->right_delimiter="}>";

$smarty2

=

new

smarty;

$smarty->template_dir=front_path.smarty_path."templates/";

$smarty->compile_dir=front_path.smarty_path."templates_c/";

$smarty->config_dir=front_path.smarty_path."configs/";

$smarty->cache_dir=front_path.smarty_path."cache/";

//定义定界符

$smarty->left_delimiter='<{';

$smarty->right_delimiter="}>";

不一定几套,

你想弄几套都行,你只要为你实例化的smarty对象做相应的设置就行啦。

php smarty 配置

我在本地测试过了,没问题的,我的发布目录为d:/www/del_smarty/

目录结构:d:/www/del_smarty/

/libs(里面包含smarty)

/templates

/templates_c

/cache

/configs

-----------------------------------------------------------------

main.php

<?php

define("SMARTY_PATH","d:/www/del_smarty/");

require_once("libs/Smarty.class.php");

$tpl = new Smarty;

/**

* 我的路径指向方式

$tpl -> template_dir = SMARTY_PATH.'templates/';

$tpl -> compile_dir = SMARTY_PATH.'templates_c/';

$tpl -> cache_dir = SMARTY_PATH.'cache/';

$tpl -> config_dir = SMARTY_PATH.'configs/';

**/

$tpl -> template_dir = 'd:/www/del_smarty/templates/';

$tpl -> compile_dir = 'd:/www/del_smarty/templates_c/';

$tpl -> cache_dir = 'd:/www/del_smarty/cache/';

$tpl -> config_dir = 'd:/www/del_smarty/configs/';

$tpl -> left_delimiter = '<{';

$tpl -> right_delimiter = '}>';

?>

---------------------------------------------------

test.php

<?php

require_once("main.php");

$tpl -> assign('title','test title');

$tpl -> assign('content','test content');

$tpl -> display('test.htm');

?>

-------------------------------------------------------

test.htm

<html>

<><br/>

<>

</html>

这个应该是php的语法错误提示,你再看看你的错误那行的标点没有在中文状态下吧?不行就Q我吧,33712313

我最近也在研究smarty,呵呵,共同研究嘛

ThinkPHP3.2.3 配置smarty模板问题

修改配置文件 ThinkPHP\Conf\convention.php

{XT:} {/XT}可根据个人喜好自定义

修改1:

// 布局设置

'TMPL_ENGINE_TYPE' => 'Smarty', // 默认模板引擎 以下设置仅对使用Think模板引擎有效

'TMPL_CACHFILE_SUFFIX' => '.html', // 默认模板缓存后缀

'TMPL_DENY_FUNC_LIST' => 'echo,exit', // 模板引擎禁用函数

'TMPL_DENY_PHP' => false, // 默认模板引擎是否禁用PHP原生代码

'TMPL_L_DELIM' => '{XT:}', // 模板引擎普通标签开始标记

'TMPL_R_DELIM' => '{/XT}', // 模板引擎普通标签结束标记

修改2:

增加

//Smarty 模版引擎配置

'TMPL_ENGINE_CONFIG' => array(

'debugging'=>false,

//'error_reporting'=>'',

//'exception_handler'=>array('ExceptionClass','ExceptionMethod'),

//'template_dir' => TMPL_PATH, //模板目录

//'compile_dir' =>TEMP_PATH ,//编译目录

//'cache_dir' =>CACHE_PATH, //缓存目录

'caching' => false, //是否启用缓存

'cache_lifetime' =>1,//缓存时间s

'left_delimiter'=>'{XT:}',

'right_delimiter' =>'{/XT}',

),

使用smarty需要修改php配置么

使用smarty不需要修改php配置,一般只需要将下载的源代码文件放置于网站目录下,然后再使用时,用require/include引入即可。

示例代码:

require 'smarty/libs/Smarty.class.php';

thinkphp使用smarty模板后如何配置success和error跳转页面

//可以在config配置文件里面自定义success和error的提示页面模板的位置

'TMPL_ACTION_SUCCESS'=>'Public:dispatch_jump',

‘TMPL_ACTION_ERROR'=>'Public:dispatch_jump',

但是会存在一个问题,smarty模板引擎是无法解析这个跳转页面的!

关于phpsmarty配置的介绍到此就结束了,不知道本篇文章是否对您有帮助呢?如果你还想了解更多此类信息,记得收藏关注本站,我们会不定期更新哦。

查看更多关于phpsmarty配置 phpstudy 配置的详细内容...

声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did196597
更新时间:2023-04-26   阅读:21次

上一篇: post提交php post提交json数据

下一篇:php检查https的简单介绍

相关资讯

最新资料更新

  • 1.php消息通知实例的简单介绍
  • 2.20个php函数 php的system函数
  • 3.phpword读写 php读写word 文档
  • 4.php怎样打开url php链接怎么打开
  • 5.php项目基本流程 php项目如何运行
  • 6.php如何页面静态化 php实现页面静态化
  • 7.php微信爬虫 微信爬虫访问是什么
  • 8.php底层c源码 php底层是用c写的吗
  • 9.php提取数组转map php 数组转xml
  • 10.iPad上装php iPad上装修建模app
  • 11.极路由安装php环境 极路由安装v2ray
  • 12.php怎么使用css php怎么使用数据库锁
  • 13.bin里面没有php bin里面没有xsync
  • 14.php代理访问源码 php 代理
  • 15.php字母循序排列 php字符串排序
  • 16.php输出jq代码 php输出hello
  • 17.主流php框架比较 php框架排行2020
  • 18.php根据城市定位 php获取位置信息
  • 19.csrfphp防的简单介绍
  • 20.php做vip解析 php解析器是什么

CopyRight:2016-2025好得很程序员自学网 备案ICP:湘ICP备09009000号-16 http://haodehen.cn
本站资讯不构成任何建议,仅限于个人分享,参考须谨慎!
本网站对有关资料所引致的错误、不确或遗漏,概不负任何法律责任。
本网站刊载的所有内容(包括但不仅限文字、图片、LOGO、音频、视频、软件、程序等)版权归原作者所有。任何单位或个人认为本网站中的内容可能涉嫌侵犯其知识产权或存在不实内容时,请及时通知本站,予以删除。

网站内容来源于网络分享,如有侵权发邮箱到:kenbest@126.com,收到邮件我们会即时下线处理。
网站框架支持:HDHCMS   51LA统计 百度统计
Copyright © 2018-2025 「好得很程序员自学网」
[ SiteMap ]