• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

php section

php 搞代码 4年前 (2022-01-23) 23次浏览 已收录 0个评论

介绍php section使用

{section name = name loop = $varName[, start = $start, step = $step, max = $max, show = true]}

name: section的名称,不用加$
$loop: 要循环的变量,在程序中要使用assign对这个变量进行操作。
$start: 开始循环的下标,循环下标默认由0开始
$step: 每次循环时下标的增数
$max: 最大循环下标

$show: boolean类型,决定是否对这个块进行显示,默认为true

例子

配置文件

<? php
$attach_sort [ 0 ][ ‘ id ‘ ] = 0 ;
$attach_sort [ 0 ][ ‘ name ‘ ] = ” 全部 ” ;
$attach_sort [ 0 ][ ‘ num ‘ ] = 30 ;
$attach_sort [ 1 ][ ‘ id ‘ ] = 1 ;
$attach_sort [ 1 ][ ‘ name ‘ ] = ” 用户通讯 ” ;
$attach_sort [ 1 ][ ‘ num ‘ ] = 30 ;
$attach_sort [ 2 ][ ‘ id ‘ ] = 2 ;
$attach_sort [ 2 ][ ‘ name ‘ ] = ” 文献综述 ” ;
$attach_sort [ 2 ][ ‘ num ‘ ] = 30 ;
$attach_sort [ 3 ][ ‘ id ‘ ] = 2 ;
$attach_sort [ 3 ][ ‘ name ‘ ] = ” 认证认可 ” ;
$attach_sort [ 3 ][ ‘ num ‘ ] = 30 ;
$attach_sort [ 4 ][ ‘ id ‘ ] = 2 ;
$attach_sort [ 4 ][ ‘ name ‘ ] = ” 仪器资料 ” ;
$attach_sort [ 4 ][ ‘ num ‘ ] = 30 ;
$attach_sort [ 5 ][ ‘ id ‘ ] = 2 ;
$attach_sort [ 5 ][ ‘ name ‘ ] = ” 实验方法 ” ;
$attach_sort [ 5 ][ ‘ num ‘ ] = 30 ;
$att来@源gao*daima.com搞@代#码网搞gaodaima代码ach_sort [ 6 ][ ‘ id ‘ ] = 2 ;
$attach_sort [ 6 ][ ‘ name ‘ ] = ” 分析方法 ” ;
$attach_sort [ 6 ][ ‘ num ‘ ] = 30 ;
$attach_sort [ 7 ][ ‘ id ‘ ] = 2 ;
$attach_sort [ 7 ][ ‘ name ‘ ] = ” 标准 ” ;
$attach_sort [ 7 ][ ‘ num ‘ ] = 30 ;
$attach_sort [ 8 ][ ‘ id ‘ ] = 2 ;
$attach_sort [ 8 ][ ‘ name ‘ ] = ” 会议论文 ” ;
$attach_sort [ 8 ][ ‘ num ‘ ] = 30 ;
$attach_sort [ 9 ][ ‘ id ‘ ] = 2 ;
$attach_sort [ 9 ][ ‘ name ‘ ] = ” 课件讲义 ” ;
$attach_sort [ 9 ][ ‘ num ‘ ] = 30 ;

$smarty -> assign( ” attach_sort ” , $attach_sort ); // 分类

?>

html 模板

{section name=sort loop=$attach_sort}
{$attach_sort[sort].name}
{/section}


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:php section

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址