Blogger Information
Blog 25
fans 0
comment 0
visits 29677
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
THINKPHP模板输出指定栏目方式
宿州市筋斗云信息科技-Vip
Original
1414 people have browsed it

THINKPHP模板输出指定栏目方式,学习阶段自己摸索,好难啊!!来记录一下自己摸索出来的前台模板输出的代码!!

控制器渲染数据给模板

$lst = db('cate')->where('status',1)->select();
$this->assign('lst',$lst);

模板接受并输出

{foreach name="lst" item="vo"}
    {if condition="$vo.id eq 17"}
        <h3>我是id为17的栏目名称</h3>
        <h4>我是栏目ID为17的栏目内容</h4>
        <h5>我们用简单表现更深的生活意义,形随心至。</h5>
     {/if}
{/foreach}

输出的方式:循环输出所有的栏目,判断栏目id是否等于指定的栏目ID,是就输出你想输出的内容!

各位大神请指点指点作为初级入门菜鸟的我吧!!这样好复杂!又木有简单的方式


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post