<?php 
/**
* smarty模板引擎中使用php函数
* by www.jb200.com
*/
require 'libs/Smarty.class.php';   
    $smarty=new Smarty;   
    $smarty->compile_check=true;   
    $smarty->debugging=true;   
    $str1='testtesttesttest';   
    $str2='this is a';   
    $str3='
脚本 学堂 www.jb200.com';   
    $str4='this is four';   
    $smarty->assign('str1',$str1);   
    $smarty->assign('str2',$str2);   
    $smarty->assign('str3',$str3);   
    $smarty->assign('str4',$str4);   
    $smarty->display('testtest.tpl');   
?>     
<html>
<head>
</head>
<body>
<p>{$str1|strlen}</p>
<p>{$str2|strpos:'is'}</p>
<p>{'utf-8'|
iconv:'gb2312':$str3}</p>
<p>{$str4|str_pad:20:"-=":STR_PAD_LEFT}</p>
</body>
</html>
{$name|str_ireplace:"<span style='color:#03C200;font-size:14px'>$name</span>":$arr