config_load总结
来源:互联网 发布:java apt 废弃 编辑:程序博客网 时间:2024/06/08 10:15
今天主要总结了一下config_load的一些属性
属性 类型 是否必须 缺省值 描述
if.conf
#全局变量
bgcolor = #00ffff
display = true // 主要起限制作用
[mycolor]
bgcolor = #cccc00
[yourcolor]
bgcolor = #123456
if.html
<body>
<form action="if_else.php" method="post">
<input type="text" name="text" />
<input type="radio" name='dq' value="left" />left
<input type="radio" name='dq' value="right" />right
<input type="radio" name='dq' value="center" />center<br />
<input type="submit" value="提交" />
</form>
</body>
if.php
<?php
include 'libs/Smarty.class.php';
$link = mysql_connect('localhost','root','123') or die('数据库连接失败');
mysql_select_db('ecshop_test',$link);
mysql_query("set names utf8");
$sql = mysql_query("select * from brand where id like '".$_POST['text']."'");
$result = mysql_fetch_row($sql);
$smarty = new Smarty();
$smarty->template_dir="demo/templates";
$smarty->compile_dir="demo/templates_c";
$smarty->config_dir="demo/config";
$smarty->left_delimiter="<{";
$smarty->right_delimiter="}>";
$smarty->assign('text',$result);
$smarty->assign('dq',$_POST['dq']);
$smarty->display('if_else.tpl');
if.tpl
<{config_load file='if.conf' section='mycolor'}>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>if_else</title>
</head>
<body bgcolor=<{ #bgcolor# }>>
<{ if #display# }> //如果display=true,则执行以下代码
<{ if $dq=='left'}>
<div style=" float:left;">
<table>
<tr>
<{ foreach from=$text item=value }>
<td><{ $value }></td>
<{ /foreach }>
</tr>
</table>
</div>
<{ elseif $dq=='right'}>
<div style=" float:right;">
<table>
<tr>
<{ foreach from=$text item=value }>
<td><{ $value }></td>
<{ /foreach }>
</tr>
</table>
</div>
<{else}>
<center><div>
<table>
<tr>
<{ foreach from=$text item=value }>
<td><{ $value }></td>
<{ /foreach }>
</tr>
</table>
</div></center>
<{/if}>
<{ else }> //如果display不等于true ,则执行以下代码
没有显示
<{/if}>
</body>
</html>
- config_load总结
- config_load的属性
- smarty-内建函数(config_load)
- smarty模板config_load使用报错原因
- smarty 从配置文件读取变量 config_load
- Smarty中的内建函数(一)config_load、foreach...
- Smarty-案例(if和config_load的应用(1))
- Smarty-案例(if和config_load的应用(2))
- Smarty-案例(if和config_load的应用(3))
- Smarty-案例(if和config_load的应用(4))
- Smarty中的内建函数(一)config_load、foreach
- PHP - Smarty模板引擎 - Manual手册 - Chapter 7. Built-in Functions第7章 内建函数 - {config_load}用于从一个配置文件加载配置变量到模板中
- 总结
- 总结
- 总结
- 总结
- 总结!
- 总结
- 学习CppUnit测试框架
- [10月16日的脚本] 在微软Lync Server 2010中启用用户和企业语音
- BCD和HEX转换程序
- Windows API 的数据类型与 Delphi 数据类型对照表
- 如何手动换监控的电源
- config_load总结
- js之ajax
- 微软等数据结构+算法面试100题(38)-- 二叉树中任意两个节点间的最大距离
- 嵌入式Linux文件系统
- Delphi 数据类型列表
- cocos2d-x 升级2.0以后报错 Assertion failed: (getShaderProgram()), function draw,
- 标准TCP/IP协议栈模型
- uva 11437 Triangle Fun
- TTL电平与CMOS电平的区别