php smarty insert用法
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用法的更多相关文章
- Smarty基础用法
一.Smarty基础用法: 1.基础用法如下 include './smarty/Smarty.class.php';//引入smarty类 $smarty = new Smarty();//实例化s ...
- oracle insert用法总结
总结下Oracle 中的Insert用法 1.标准Insert --单表单行插入 语法: INSERT INTO table [(column1,column2,...)] VALUE ...
- vector中erase()与insert()用法
erase()用法:https://blog.csdn.net/duan19920101/article/details/50717748 注:erase是删除指定位置的元素,不能删除给定元素值.若要 ...
- MyBatis从入门到精通(第2章):MyBatis XML方式的基本用法【insert用法、update用法、delete用法】
2.4 insert 用法 2.4.1 简单的 insert方法 在接口 UserMapper.java 中添加如下方法. /** * 新增用户 * @param sysUser * @retur ...
- ecshop insert用法
1 {insert name='ads' id=$ads_id num=$ads_num} 控制语句是在 /includes/lib_insert.php 文件.这个文件是ecshop动态内容函数库. ...
- smarty -- foreach用法
{foreach},{foreachelse} 用于像访问序数数组一样访问关联数组 {foreach},{foreachelse} {foreach} is used to loop over an ...
- Oracle 中的Pivoting Insert用法
1.标准Insert --单表单行插入 语法: INSERT INTO table [(column1,column2,...)] VALUE (value1,value2,...) ...
- UPDATE/INSERT用法研究
UPDATE和INSERT语法相信大家都很熟悉,UPDATE的基本语法结构是 : UPDATE 表名称 SET 列名称 = 新值 WHERE 列名称 = 某值 INSERT的基本语法是: INSERT ...
- C++ string类insert用法总结
body, table{font-family: 微软雅黑; font-size: 13.5pt} table{border-collapse: collapse; border: solid gra ...
随机推荐
- 读jQuery官方文档:jQuery对象
jQuery对象 当用$符号包裹一个CSS风格选择器的时候,你得到一个jQuery对象. var heading = $('h1'); jQuery对象是对DOM ELement封装过后的数组.注意, ...
- Android的自动对焦
1,什么是自动对焦? ---安卓的自动对焦的概念是指能够在指定的位置计算出准确的焦点位置. 这个就好像是传统意义上的手动对焦.但是google是这个意思. 2.什么是追焦? ----安卓的追焦是指FO ...
- 20个linux命令行工具监视性能(下)
昨天晚上第一次翻译了<20 Command Line Tools to Monitor Linux Performance>中的前十个命令,翻译得不是很好,今天晚上继续把后面的十个也翻译给 ...
- 中文字符集编码Unicode ,gb2312 , cp936 ,GBK,GB18030
中文字符集编码Unicode ,gb2312 , cp936 ,GBK,GB18030 内容详见: http://www.360doc.com/content/11/1004/12/6139921_1 ...
- Windows Forms(二)
导读 1.用VS创建一个Windows Forms程序 2.分析上面的程序 3.Mediator pattern(中介者模式) 4.卡UI怎么办——BackgroundWorker组件 用VS创建一个 ...
- Oracle PL/SQL 多重选择句
Oracle中语句块的基本格式: declare --变量定义,初始化赋值. begin --变量的赋值,函数调用,if,while等. end: Oracle中的语句:关系运算符:= <> ...
- Wix: Using Patch Creation Properties - Minor Update
Based on the project created in Wix: Using Patch Creation Properties - Small Update, Following chang ...
- MSBuild could not create or connect to a task host with runtime "CLR2" and architecture "x86".
vs2010 and vs2012 are installed on target machine. Build c# project using vs2010, following error oc ...
- linux下搭建nginx+php(FastCGI)+mysql运行环境
一.安装环境 1.CentOS5.5 2.php5.4 3.MySQL5.5.19 二.安装程序依赖库和开发环境 为了省事把所需要的库文件全都安装上,可以使用rpm包安装,也可以用yum命令安装, 1 ...
- 第43条:返回零长度的数组或者集合,而不是null
private final List<Cheese> cheesesInStock = ...; public Cheese[] getCheese() { if(cheesesInSto ...