smarty 对数据库的简单操作。
来源:互联网 发布:剑网三谢云流捏脸数据 编辑:程序博客网 时间:2024/04/29 03:04
smarty简单配置
-------------------------------------smarty_inc.php--------------------------------------------
<?php
include_once("./smarty/Smarty.class.php");
$smarty=new Smarty();
$smarty->config_dir="smarty/Config_File.class.php";//目录变量
$smarty->caching=false;//是否使用缓存
$smarty->template_dir="./templates";//设置模板目录
$smarty->compile_dir="./templates_c";//设置编译目录
$smarty->cache_dir="./smarty_cache";//缓存文件夹
$smarty->left_delimiter="{";
$smarty->right_delimiter="}";
?>
----------------------------------index.php---------------------------------------------------
<?php
include("config.php");
$sql=mysql_query("select * from xinxi order by id desc");
while($row=mysql_fetch_array($sql)){
$arrdata[]=$row;
}
$smarty->assign("xx",$arrdata);
$smarty->display("index.htm");
?>
-----------------------------------index.htm 模板文件 主要操作 如何应用section循环二维数组--------------------------------------------
<?php include("config.php");?>
<html
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<hr />
<a href="">首页</a>|<a href="">流言</a>|
<hr />
<body>
<form action="" method="post" name="form2">
<table bgcolor="#FFFFCC" width="800" align="left" cellpadding="0" cellspacing="1">
<tr >
<tr>
<td align="center" width="50" height="20">标题
</td>
<td align="center" width="300" height="20">内容
</td>
<td align="center" width="100" height="20">留言时间
</td>
</tr>
{section name=list loop=$xx} //主要显示代码
<tr>
<td align="center" width="50">
<input name="del[]" type="checkbox" value="" />
</td>
<td align="center" width="50" height="20">{$xx[list].title}
</td>
<td align="left" width="300" height="20">{$xx[list].content}
</td>
<td align="center" width="100" height="20">{$xx[list].createtime}
</td>
</tr>
{/section}
</tr>
<tr>
<td width="6">
</td>
<td width="200" >
</td>
</tr>
</table>
</form>
</body>
</html>
- smarty 对数据库的简单操作。
- 对数据库的简单操作
- c#中对数据库的简单操作
- SQL对数据库表的简单操作
- 对数据库的一些简单操作
- hibernate对数据库的简单操作
- Qt对数据库的简单操作
- XUtils对数据库的简单操作
- Smarty操作数据库
- 对SQL简单介绍、数据库、表的简单操作
- 用Java对数据库进行简单操作的准备操作
- 登陆ORACLE数据库和对数据库的一些简单操作
- MAMP链接数据库并且对数据库操作的简单示例
- PHP程序中使用PDO对象实现对数据库的增删改查操作(PHP+smarty)
- Yii2.0 对数据库 查询的一些简单的操作
- Yii2.0 对数据库查询的一些简单的操作
- Yii2.0 对数据库 查询的一些简单的操作
- Yii2.0 对数据库 查询的一些简单的操作
- zf工作流程
- sleep synchronized wait notify notifyAll
- Environmental Pollution
- 一个简单的回调函数模型
- 我的第一篇文章~
- smarty 对数据库的简单操作。
- 8086指令系统及易错点
- 重新开始!
- c/c++ 文件复制(拷贝)
- 一起来学周易(4)——天干地支
- 提个问题:有没有需求分析和设计方面的经验文章或者经典书籍推荐,谢谢大家。
- php+ mysql留言板的制作函数
- Adapt模式
- 配置silverlight开发工具