利用Smarty实现文本隔行变色
来源:互联网 发布:怎样养淘宝小号 编辑:程序博客网 时间:2024/06/08 12:31
php页面
<?php
include "libs/Smarty.class.php";
$smarty = new Smarty();
$link = mysql_connect('localhost','root','123');
mysql_select_db('ecshop',$link);
mysql_query("set names utf8");
$sql = "select * from ecs_brand";
$result = mysql_query($sql);
$rows = array();
while($row = mysql_fetch_assoc($result)){
$rows[] = $row;
}
$smarty -> assign('list',$rows);
$smarty -> display('1.html');
模板页面设计
<body>
<table>
<tr>
<th>商品id</th>
<th>商品名称</th>
<th>商品logo</th>
<th>商品描述</th>
</tr>
{foreach from=$list item='value' key='k' name='color'}
{if $smarty.foreach.color.iteration%2== 0}
<tr bgcolor="blue">
<td>{$value.brand_id}</td>
<td>{$value.brand_name}</td>
<td>{$value.brand_logo}</td>
<td>{$value.brand_desc}</td>
</tr>
{else}
<tr bgcolor="red">
<td>{$value.brand_id}</td>
<td>{$value.brand_name}</td>
<td>{$value.brand_logo}</td>
<td>{$value.brand_desc}</td>
</tr>
{/if}
{/foreach}
</table>
</body>
- 利用Smarty实现文本隔行变色
- smarty中使用实现隔行变色
- 利用Javascript实现隔行变色
- 实现文本的隔行变色效果
- 利用jquery一句话实现隔行变色
- 利用for循环实现的隔行变色
- 实现表格隔行变色
- jquery实现隔行变色
- jQuery实现隔行变色
- 隔行变色jquery 实现
- 实现隔行变色
- jQuery实现隔行变色
- jquery实现隔行变色
- jquery实现隔行变色
- js 实现隔行变色
- JS实现隔行变色
- jquery 实现隔行变色
- 利用Repeater中的AlternatingItemTemplate实现table隔行变色
- 带有事务的存储过程的写法
- 还在为电脑反应慢惆怅么?现在教你怎么为电脑'减肥'!
- android启动模式
- js验证身份证号码(包括与用户输入性别,生日的匹配性验证)
- U-boot-200908在FL2440上的移植(一)--uboot在RAM中运行
- 利用Smarty实现文本隔行变色
- Cross-compiling your eLua programs(交叉编译你的eLua程序)
- centos 安装mono 遇到问题
- 关于html5的一些历史和优点
- 贪吃蛇类图和顺序图
- 字符,字节和编码
- ul li 更改样式
- Fatal error: Can’t open and lock privilege tables: Table ‘mysql.host’ doesn’t exist
- eclipse Maven配置