smarty中数组array怎么使用呢
来源:互联网 发布:淘宝网优惠券 编辑:程序博客网 时间:2024/06/11 17:12
提问:kdchxue
代码如下:
以下是html的代码: <html>
{section name=list loop=$title} <b><font color=red>
{$title[list].name},{$title{list}.date} </font></b><Br> {/section} </html>
以下是php的代码: <?php
include ("smarty_inc.php"); $name[]=array("name"=>"新闻第一条","date"=>"2008-11-14");
$name[]=array("name"=>"php100中文","date"=>"2008-11-14");
$name[]=array("name"=>"免费视频教程","date"=>"2008-11-14");
$name[]=array("name"=>"圣诞快乐","date"=>"2008-11-14");
$name[]=array("name"=>"中国最好","date"=>"2008-11-14"); $smarty->assign("title",$name); $smarty->display("index.htm"); ?> 我想问下
1.在htm中name=list这句话是定义什么概念一直没理解。 2.loop是用作什么的?
3.{title[list].name}和{title[list].date}中title[list]这个是什么意思。
4.如果是3维或者更高维的数组要怎么写?
4个问题请教phper哈,可能问的很白痴,但是我是刚入门,这句话理解好久都没搞懂哦,谢谢啦 回答:kdchxue
1.在htm中name=list这句话是定义什么概念一直没理解。 答:name就是当前这个section的名字,如果这个section裏面还有一个section,就得再起个名字以示区分 2.loop是用作什么的?
答:loop是循环体数组,就是从数据库取出的数据。 3.{title[list].name}和{title[list].date}中title[list]这个是什么意思。
答:这个list就是你在name中定义的名称,也可以定义成其他名字
4.如果是3维或者更高维的数组要怎么写? 假设$data是个三维数组,
第一维是订单列表,每个订单中有一个数组是该订单的商品列表 {section name=list loop=$data} 订单名:{$data[list].title}
{section name=slist loop=$data.product} 商品名:{$data.product[slist].title} {/section} {/section}
- smarty中数组array怎么使用呢
- 怎么定义二维数组呢
- [置顶] PHP有无必要使用Smarty呢??
- C++中数组怎么使用
- jquery中使用smarty的数组变量(json)
- swift中array数组的使用
- swift中array数组的使用
- smarty中使用变量
- smarty中使用变量
- smarty中使用popup
- ThinkPHP5中使用Smarty
- smarty中section 循环数组
- 怎么使用数据库呢123412341234
- Smarty For Sae(sae中使用smarty)
- C#中两个窗口怎么传递参数?或者怎么使用另一个窗口的控件呢?
- 下面代码中,数组LA[ ]维度怎么就自动扩充了呢
- Array数组使用总结
- array数组的使用
- {html_options options=$item.options selected=$item.value}
- access内置函数:(适用access2000)-…
- 退换货须知
- 在SQL Server和Access中清空表并重…
- bindService
- smarty中数组array怎么使用呢
- 一个男人关心的东西 决定了他的层…
- 【转载】smarty --foreach详解(不错不错)
- 世界上最健康的作息时间表
- smarty中往insert中传参数的方法 .
- 新技术总结和拓展
- 序列化和反序列化
- css定义图片列表图片不变形
- Java运算符