11.smarty 对象
来源:互联网 发布:一淘跟淘宝有关系吗 编辑:程序博客网 时间:2024/06/06 07:10
对象:
过滤器:
后预处理器:
输出滤镜:
MyFilter.php
<?phprequire_once './libs/Smarty.class.php';$smarty = new Smarty();//$smarty->debugging = true;$smarty->left_delimiter = "{<";$smarty->right_delimiter = ">}";//这是一个函数function remove_dw_contents($tpl_source,&$smarty){ //echo "OKOK";die; //这里的预处理器就是把 tpl 文件中的<!--#.*--> 替换成 "" return preg_replace("/<!--#.*-->/U","aaa",$tpl_source);}//这个是注册一个预处理器,相当于把函数查到 $smarty->display() 函数 之前//没有下面一句话,会生成注释//切面编程,拦截器$smarty->register_prefilter('remove_dw_contents');//后预处理器function add_header_comment($tpl_source, &$smarty){ return "<?php echo \"<!-- W J H -->\n\" ?>\n".$tpl_source;}$smarty->register_postfilter('add_header_comment');$smarty->display('test6.tpl');
test6.tpl
<h1>test6页面</h1><!--#hello world--><h2>其他内容</h2>
0 0
- 11.smarty 对象
- Smarty--面向对象
- smarty之数据对象
- smarty之对象注册
- php Smarty高级 数据对象
- php smarty高级 对象注册
- smarty 注册对象 并使用 实例代码
- 面向对象封装ADODB类库+Smarty模板
- smarty中的高级特性(-) 对象的使用
- Smarty
- Smarty
- smarty
- smarty
- Smarty
- smarty
- smarty
- smarty
- smarty
- myeclipse加载项目,出现"大量红叉"
- windows下的C:\Windows\System32\drivers\etc\hosts
- HDU2852 KiKi's K-Number(二分+树状数组)
- Android SO逆向1-ARM介绍
- PAT_Basic 1011
- 11.smarty 对象
- 大学毕业4年-回顾和总结(2)-钱,收入和支出
- JVM之对象生死
- Node.js模块引入
- Mathematica字符串处理之-mywife.cc
- 严格模式
- 障碍滑雪比赛(Slalom,UVa 11627)
- 关于Eigen::MatrixBase< Derived >
- HOOK的测试代码