php 使用smarty变量,php smarty变量的修饰

php smarty变量的修饰

test.php代码: view plaincopy to clipboardprint?

assign("total",$total); //对模版中的变量赋值 $formatted_total = number_format($total); //格式化$total $smarty->assign("formatted_total",$formatted_total); //对模版中的变量赋值 $smarty->display('test1.htm'); //显示页面 ?>

assign("total",$total); //对模版中的变量赋值 $formatted_total = number_format($total); //格式化$total $smarty->assign("formatted_total",$formatted_total); //对模版中的变量赋值 $smarty->display('test1.htm'); //显示页面 ?> test1.html模板代码: view plaincopy to clipboardprint?

Total is {$total}

Formatted Total is {$formatted_total}

Total is {$total}

Formatted Total is {$formatted_total}

编译后的test.html.php代码: view plaincopy to clipboardprint?

Total is _tpl_vars['total']; ?>

Formatted Total is _tpl_vars['formatted_total']; ?>

Total is _tpl_vars['total']; ?>

Formatted Total is _tpl_vars['formatted_total']; ?>

test1.html模板可以改写成这样test2.html: view plaincopy to clipboardprint?

Total is {$total}

Formatted Total is {$total|number_format}

Total is {$total}

Formatted Total is {$total|number_format}

则相应的test.php代码改为: view plaincopy to clipboardprint?

assign("total",$total); //对模版中的变量赋值 $smarty->display('test2.htm'); //显示页面 ?>

assign("total",$total); //对模版中的变量赋值 $smarty->display('test2.htm'); //显示页面 ?> 浏览器显示: Total is 12345 Formatted Total is 12,345 本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/zhuzhao/archive/2009/03/19/4006030.aspx 本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/zhuzhao/archive/2009/03/19/4006030.aspx

相关文档:

在php中计算时间差有时候是件麻烦的事!不过只要你掌握了日期时间函数的用法那这些也就变的简单了:

一个简单的例子就是计算借书的天数,这需要php根据每天的日期进行计算,下面就来谈谈实现这种日期计算的几种方法:

(1) 如果有数据库就很容易了!若是MSSQL可以使用触发器!用专门计算日期差的函数datediff()便可 ......

When I deploy php application on apache, some problem come out, and solved. Here's the tips and problems solved.

0.How could I deploy an apache server armed with php, mysql, perl, and phpMyAdmin on the fly?

You need a package bundled with all these tools,  xampp shall meet you needs, you can ......

import java.io.IOException;

import java.security.SecureRandom;

import javax.crypto.Cipher;

import javax.crypto.SecretKey;

import javax.crypto.SecretKeyFactory;

import javax.crypto.spec.DESKeySpec;

import sun.misc.BASE64Decoder;

import sun.misc.BASE64Encoder;

public class DES {

private byte ......

1.基本类

//smarty_config.php

define('TEMPLATE_DIR','templates/');

define('COMPILE_DIR','templates_c/');

define('CONFIG_DIR','configs/');

define('CACHE_DIR','cache/');

?>

//View.class.php

//配置文件

require_once 'configs/smart_config.php';

//Smarty类

require('smarty/ ......

需要用的php的正规匹配汉字,在网上找了些文章看了以下,看到这个的时候感觉这篇文章写的很真实,忍不住转过来了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值