php中的section,php section

ゞ 浴缸里的玫瑰 2023-01-15 11:23 253阅读 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 ;

$attach_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}

< a href =”list.php?sort={$attach_sort[sort].id}{if $keyword}&keyword={$keyword}{/if}“ {if $sort =={$attach_sort[sort].id}}class=”fox”{/if} > {$attach_sort[sort].name} a >

{/section}

本文原创发布php中文网,转载请注明出处,感谢您的尊重!

发表评论

表情:
评论列表 (有 0 条评论,253人围观)

还没有评论,来说两句吧...

相关阅读

    相关 Theme Section

    题意: 就是每一首歌都是EAEBE这样的类型,其中A和B可以没有,就是让你找出来E的最大长度   题解: 第一种思路: 可以先找出来头和尾的最大相同程度,最小可以从1

    相关 conic section

    二次曲线([conic section][]) 顺便推荐一[个网站][conic section],该网站是向高中生讲解各种几何体定义的,真的是浅显易懂,值得珍藏 1.什