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 对数据库的简单操作。的更多相关文章

  1. Python --链接MYSQL数据库与简单操作 含SSH链接

    项目是软硬件结合,在缺少设备的情况,需要通过接口来模拟实现与设备的交互,其中就需要通过从数据库读取商品的ID信息 出于安全考虑  现在很多数据库都不允许通过直接访问,大多数是通过SSH SSH : 数 ...

  2. 使用spring框架的JdbcTemplate实现对Oracle数据库的简单操作实例

    最近实现了一个小功能,针对Oracle数据库两张关联表进行查询和修改,因为比较简单,所以选择了spring框架里的JdbcTemplate.JdbcTemplate算是老古董了,是当年spring为了 ...

  3. 在php中需要用到的mysql数据库的简单操作

    1.数据库连接 1.1用windows命令行链接数据库服务器 几个DOS命令 在DOS环境下命令后面没有分号,在MySQL环境下,命令后面有分号 进入盘符: 语法:盘符: 进入盘符下的某个文件夹 语法 ...

  4. 用C#对ADO.NET数据库完成简单操作

    数据库访问是程序中应用最普遍的部分.随着C#和ADO.NET的引入,这种操作变得更简单.这篇文章将示范四种最基础的数据库操作. ● 读取数据.其中包括多种数据类型:整型,字符串,日期型. ● 写数据. ...

  5. sqlite数据库之简单操作

    一 sqlite介绍 Sqlite是一种嵌入式数据库,类似于一个文件系统,是跟程序在一起的.跟mysql等数据库程序跟数据分离是不一样的. 应用场景:常用于保存本地配置,类似于本地文件系统,因此他内嵌 ...

  6. 【MySQL】初识数据库及简单操作

    一.数据库概述 1.1 什么是数据(Data) 描述事物的符号记录称为数据,描述事物的符号既可以是数字,也可以是文字.图片,图像.声音.语言等,数据由多种表现形式,它们都可以经过数字化后存入计算机. ...

  7. C#连接SQL Server数据库进行简单操作

    环境:VS2010 + SqlServer 2008 首先,按照面向对象的程序设计思想,设计一个数据库操作工具类MyTool.cs,该类中封装了关于数据库连接和操作的方法,各个功能模块在需进行数据库操 ...

  8. Java连接MySQL数据库及简单操作代码

    1.Java连接MySQL数据库 Java连接MySql需要下载JDBC驱动MySQL-connector-java-5.0.5.zip(举例,现有新版本).然后将其解压缩到任一目录.我是解压到D盘, ...

  9. python+mysql数据库的简单操作

    最近接了一个任务,测试某项类似于收益情况报表的功能,因计算公式复杂,单纯手算过于复杂,所以想到写成脚本 根据python的分治原则,先整了几个函数用于实现计算逻辑,后发现数据输入过于繁琐,所以决定使用 ...

随机推荐

  1. 【问题】bzip2 --version 2>&1 < /dev/null

    https://unix.stackexchange.com/questions/230887/what-does-dev-null-mean https://stackoverflow.com/qu ...

  2. centos7下安装zookeeper&zookeeper集群的搭建

    一.centos7下安装zookeeper 1.zookeeper 下载地址 https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/ 2.安装步骤 ...

  3. Flyme密码验证策略升级,忘记锁屏密码及「关机密码」功能

      手机里有很多需要用到密码的地方,比如「手机密码」.「文档锁定区」.「应用加密」.「隐私模式」.忘记密码可是一件麻烦事,以前只能通过清除数据或格式化存储盘来解决.现在有了「关联魅族账号」功能,这些功 ...

  4. 算法笔记--BSGS && exBSGS 模板

    https://www.cnblogs.com/sdzwyq/p/9900650.html 模板: unordered_map<int, int> mp; LL q_pow(LL n, L ...

  5. Java基础 static限定符的使用 以及【 static实现的 singleton(单例)设计模式】

    static实现的 singleton(单例)设计模式 /** static实现的 singleton设计模式 , 使得一个类只能够创建一个static对象 */ 模板设计结构: package Co ...

  6. linux服务器日志剖析

    常规tomcat,apache,nginx,错误日志,还有项目log4j日志 tomcat (以tomcat7.082为例) tomcat日志配置 运行日志和访问日志结合在一起,先说下日志哪边配置,在 ...

  7. 属性 Attribute

    一.创建属性 [AttributeUsage(AttributeTargets.Class | AttributeTargets.Constructor, AllowMultiple = true, ...

  8. 获取TableViewer里面的所有TableViewerColumn

    private TableViewerColumn[] getTableViewerColumns(TableViewer tableViewer) { TableColumn[] columns = ...

  9. SEERC 2018 B. Broken Watch (CDQ分治)

    题目链接:http://codeforces.com/gym/101964/problem/B 题意:q 种操作,①在(x,y)处加一个点,②加一个矩阵{(x1,y1),(x2,y2)},问每次操作后 ...

  10. Consul概述

    环境安装 1.下载consul 官网https://www.consul.io/downloads.html下载对应版本的consul:本文以Windows-64版本为例 2.配置到系统环境变量 C: ...