smarty实例教程之三:----实例篇( 使用php内置MYSQL函数) [ 2006/08/28 22:18 | by chaizx ] 从本节开始我们来学习一下如果把smarty应用到实际的例子中. 为了演示说明,我将以前写的一个站点作为实例来讲来下.先说明一下, 我本人的美术功底不是很强,所以设计出来的页面不太好看,大家就对付着看吧 在看本文之前,可以先看看indexbak.htm与newsbak.htm,它们是我们生成后的例图。 一、 首先来说明一下我们将要使用到的数据库,下面...
smarty技术是php的精髓所在,随着php版本的逐渐提高,原来的很多方法也许太过时了,下面我就针对最新的php5.1.1版本的使用,配置说说如何配置。 下面是一步步的来的,请注意: 1、在官方下载模板库文件: http://smarty.php.net/download.php 下载了就解压,看见一个文件夹了,是个 smarty.x.x,打开,里面有个libs 文件夹,ok,注意这个东西就是我们要的。 2、在你的网站目录下面,比方我的php网站IIS在物理 硬盘 的 d:/web/web/...
[CODE:] [color="#ff6600"] require_once('./Path.Setting.php'); require_once('./Setting.Inc.php'); require_once(QuiZ_Path.'../Classes/FileName_Set.php'); $link = new ExecSQL(); #SQL操作 $menu = new Menu_Class(); #菜单生成 $link -> SetSQL("Select * From ".Base::$Menu_Left." order by path"); $menu -> Set_Array($link -> Query_array()); $smarty -> assign('menu_select',$men...
一、什么是smarty? smarty是一个使用php写出来的模板php模板引擎,它提供了逻辑与外在内容的分离,简单的讲,目的就是要使用php程序员同美工分 离,使用的程序员改变程序的逻辑内容不会影响到美工的页面设计,美工重新修改页面不会影响到程序的程序逻辑,这在多人合作的项目 中显的尤为重要。 二、smarty优点: 1. 速度:采用smarty编写的程序可以获得最大速度的提高,这一点是相对于其它的模板引擎技术而言的。 2. 编译型:采用sm...
在smarty.php中有如下代码: include_once('../smarty/smarty.class.php'); $smarty = new smarty(); $smarty ->template_dir = "../templates/"; //设置模板目录 $smarty ->compile_dir = "../souces/news/"; //设置目编辑目录 $smarty ->cache_dir = "../cache/"; //设置绶存 $smarty ->cache_lifetime = 60*60*24; //设置绶存时间 $smarty ->caching=false; $smarty ->force_compile=true;//强制重新生成编译文件 $smarty ->le...
?php /** * 函数:(Adodb + smarty) 内容列表分页 * 版本:最终(完美处理了导航链接) * 已通过Mysql、Oracle 测试 * 时间:2006/9/29 * 作者:欣然随风 * * 参数: * @table -- 表名 * @pageSize-- 每页信息数 * @midPage -- 导航链接数量 * @where -- 查询条件 * * 全局变量: * @conn -- 数据库操作object * @tpl -- 模板操作object * @start -- 返回的LIMIT的开始下标 * */ function page($table,$pageSize...
函数: ?php /** * 函数:(Adodb + smarty) 内容列表分页 * 版本:最终(完美处理了导航链接) * 已通过Mysql、Oracle 测试 * 时间:2006/9/29 * 作者:欣然随风 * * 参数: * @table -- 表名 * @pageSize-- 每页信息数 * @midPage -- 导航链接数量 * @where -- 查询条件 * * 全局变量: * @conn -- 数据库操作object * @tpl -- 模板操作object * @start -- 返回的LIMIT的开始下标 * */ function page($table,$pa...
我第一次使用,出现这个问题,请问怎么办呢 Warning: main(../libs/smarty.class.php): failed to open stream: No such file or directory in d:\usr\www\html\test\index.php on line 3 Fatal error: main(): Failed opening required '../libs/smarty.class.php' (include_path='.;c:\php4\pear') in d:\usr\www\html\test\index.php on line 3
?php require_once('./FCKeditor/fckeditor.php'); require_once('./smarty/smarty.class.php'); //载入smarty $smarty = new smarty(); /* smarty配置 */ $smarty->template_dir = "./templates/default"; $smarty->compile_dir = "./templates/compiled"; // $smarty->config_dir = "./templates/configs"; // $smarty->cache_dir = "./caches"; $smarty->left_delimiter = '{'; $smarty->right_delimiter = '/}'; createEdito...