insert用于模板中。

用法:{insert name="method_name"}

此时会寻找php文件中方法名为:insert_method_name的函数,

将其返回值作为insert语句的值。

例子:

<?php
require("Smarty.class.php");
$smarty = new Smarty();
$smarty -> template_dir = "./templates"; //模板存放目录
$smarty -> compile_dir = "./templates_c"; //编译目录
$smarty -> cache_dir = "./cache"; //缓存目录
$smarty -> config_dir = "./configs"; //缓存目录 function insert_nowTime() {
return date("Y-m-d H:i:s");
} $smarty -> display('insert.tpl'); ?>

模板文件中:

<html>
<head>
<title></title>
</head>
<body> 当前时间:
{insert name="nowTime"} </body>
</html>

php smarty insert用法的更多相关文章

  1. Smarty基础用法

    一.Smarty基础用法: 1.基础用法如下 include './smarty/Smarty.class.php';//引入smarty类 $smarty = new Smarty();//实例化s ...

  2. oracle insert用法总结

    总结下Oracle 中的Insert用法   1.标准Insert --单表单行插入   语法:     INSERT INTO table [(column1,column2,...)] VALUE ...

  3. vector中erase()与insert()用法

    erase()用法:https://blog.csdn.net/duan19920101/article/details/50717748 注:erase是删除指定位置的元素,不能删除给定元素值.若要 ...

  4. MyBatis从入门到精通(第2章):MyBatis XML方式的基本用法【insert用法、update用法、delete用法】

    2.4  insert 用法 2.4.1  简单的 insert方法 在接口 UserMapper.java 中添加如下方法. /** * 新增用户 * @param sysUser * @retur ...

  5. ecshop insert用法

    1 {insert name='ads' id=$ads_id num=$ads_num} 控制语句是在 /includes/lib_insert.php 文件.这个文件是ecshop动态内容函数库. ...

  6. smarty -- foreach用法

    {foreach},{foreachelse} 用于像访问序数数组一样访问关联数组 {foreach},{foreachelse} {foreach} is used to loop over an  ...

  7. Oracle 中的Pivoting Insert用法

    1.标准Insert --单表单行插入   语法:   INSERT INTO table [(column1,column2,...)] VALUE (value1,value2,...)      ...

  8. UPDATE/INSERT用法研究

    UPDATE和INSERT语法相信大家都很熟悉,UPDATE的基本语法结构是 : UPDATE 表名称 SET 列名称 = 新值 WHERE 列名称 = 某值 INSERT的基本语法是: INSERT ...

  9. C++ string类insert用法总结

    body, table{font-family: 微软雅黑; font-size: 13.5pt} table{border-collapse: collapse; border: solid gra ...

随机推荐

  1. 学习GraphX

    首先准备如下社交图形数据:

  2. h2database源码浅析:事务、两阶段提交

    Transaction Isolation Transaction isolation is provided for all data manipulation language (DML) sta ...

  3. 利用CodeSmith生成抽象工厂步骤

    其实CodeSmith挺好的,帮我们主动生成不少代码,并且代码质量不错,下面就来介绍一下利用CodeSmith生成抽象工厂步骤 打开codesmith模板的buildall 注意path的设置,因为后 ...

  4. Plugin with id 'android-apt' not found

    解决路径: 1.查看miniSDK最外面的build.gradle 添加这句.具体参考一下demo.谢谢

  5. Android开发之万能适配器

    ListView.GridView等等非常多的东西都需要适配器.而如果开发一个app每一个listview都有写一个Adapter的话,那还怎么愉快的玩游戏.. 什么是ViewHolider以及的用法 ...

  6. 从V$SQL_PLAN中FORMAT执行计划

    10G版本 select sql_id from v$sqlarea where sql_text like'%xxx%'; select  * from v$sql_plan where sql_i ...

  7. C++例题练习(1)

    环境:Dev-C++( Version:5.6.1) 一.求2个或3个正整数中的最大数,用带有默认参数的函数实现 代码实现: #include <iostream> using names ...

  8. Android系统简介(上):历史渊源

    上个月,看到微信的一系列文章,讲到Linux的鼻祖-李纳斯的传记<Just for Fun>, 其人神乎其能, 其人生过程非常有趣,值得每个程序员细细品味. 而实际上,对我而已,虽然做软件 ...

  9. oracle创建存储过程并返回结果集(附C#调用代码)

    使用存储过程中,最常用的莫过于查询数据表,并返回结果集. 在SQL SERVER 中,这类操作最简单,通过简单的select * from xx 即可完成.但是在Oracle中并不支持这种写法,那么我 ...

  10. 07_XPath_02_常用语法

    [工程截图] [person.xml] <?xml version="1.0" encoding="UTF-8"?> <students> ...