首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > PHP >

smarty 如何在模板上循环遍历输出三维数据?

2013-08-26 
smarty 怎么在模板上循环遍历输出三维数据???这个从php传过来的数组结构。Array([0] Array([0] Array

smarty 怎么在模板上循环遍历输出三维数据???
这个从php传过来的数组结构。

Array
(
    [0] => Array
        (
            [0] => Array
                (
                    [id] => 15
                    [pid] => 0-2-11
                    [name] => 女装
                    [href] => 
                    [date] => 
                )

            [1] => Array
                (
                    [id] => 18
                    [pid] => 0-2-11
                    [name] => 衬衣
                    [href] => 
                    [date] => 
                )

            [2] => Array
                (
                    [id] => 40
                    [pid] => 0-2-11
                    [name] => www
                    [href] => 


                    [date] => 
                )

            [3] => Array
                (
                    [id] => 45
                    [pid] => 0-2-11
                    [name] => 费共和
                    [href] => 
                    [date] => 
                )

        )

    [1] => Array
        (
        )

    [2] => Array
        (
            [0] => Array
                (
                    [id] => 43
                    [pid] => 0-2-13
                    [name] => 呃呃
                    [href] => 
                    [date] => 
                )

        )

    [3] => Array
        (
        )

    [4] => Array
        (


        )

    [5] => Array
        (
        )

    [6] => Array
        (
        )

    [7] => Array
        (
            [0] => Array
                (
                    [id] => 41
                    [pid] => 0-3-16
                    [name] => 呜呜呜
                    [href] => 
                    [date] => 
                )

        )

    [8] => Array
        (
            [0] => Array
                (
                    [id] => 44
                    [pid] => 0-3-21
                    [name] => 阿斯顿
                    [href] => 
                    [date] => 
                )

        )

    [9] => Array
        (
        )



    [10] => Array
        (
        )

    [11] => Array
        (
        )

    [12] => Array
        (
            [0] => Array
                (
                    [id] => 42
                    [pid] => 0-9-38
                    [name] => 高交会馆
                    [href] => 
                    [date] => 
                )

        )

)
smarty 如何在模板上循环遍历输出三维数据?


{foreach item=lop key=k name=loop from=$dao}
              <li {if $lop.id==10}class="wu"{/if}><a href="{$lop.href}">{$dao[$k].name}</a>
    {foreach item=lop2 key=kk name=loop1 from=$dao1}
         { if $k==$kk && $dao1[$kk]
------解决方案--------------------


@count neq 0}
          <ul>
         {foreach item=lop3 key=kkk from=$lop2}
<li><a href="">{$lop3.name}</a>
{foreach item=lop4 key=kkkk from=$dao2}
{if $dao2[$kkk]
[解决办法]
@count neq 0}
{foreach item=lop5 name=app key=kkkkk from=$lop4}
{if $lop5.pid===$lop3.pid
[解决办法]
cat:"-"
[解决办法]
cat:$lop3.id}
{if $smarty.foreach.app.index==0}<ul>{/if}
<li><a href="#">{$lop5.name}</a></li>
{if $smarty.foreach.app.iteration==$lop4
[解决办法]
@count}
</ul>{/if}
{/if}
{/foreach}
{/if}
{/foreach}
</li>
{/foreach}
</ul>
{/if}
{/foreach}

</li>
{/foreach}

热点排行