Smarty How to iterate through the output three-dimensional data on the template???

Source: Internet
Author: User
Smarty PHP Multidimensional Array loops

The structure of the array passed from PHP.

Array
(
[0] = = Array
(
[0] = = Array
(
[id] = 15
[PID] = 0-2-11
[Name] + women's Clothing
[HREF] =
[Date] = =
)

[1] = = Array
(
[id] = 18
[PID] = 0-2-11
[Name] + shirt
[HREF] =
[Date] = =
)

[2] = = Array
(
[id] = 40
[PID] = 0-2-11
[Name] = www
[HREF] =
[Date] = =
)

[3] = = Array
(
[id] = 45
[PID] = 0-2-11
[Name] = Fee Republic
[HREF] =
[Date] = =
)

)

[1] = = Array
(
)

[2] = = Array
(
[0] = = Array
(
[id] = 43
[PID] = 0-2-13
[Name] and, uh, uh,
[HREF] =
[Date] = =
)

)

[3] = = Array
(
)

[4] = = Array
(
)

[5] = = Array
(
)

[6] = = Array
(
)

[7] = = Array
(
[0] = = Array
(
[id] = 41
[PID] = 0-3-16
[Name] = Woo Hoo
[HREF] =
[Date] = =
)

)

[8] = = Array
(
[0] = = Array
(
[id] = 44
[PID] = 0-3-21
[Name] = Aston
[HREF] =
[Date] = =
)

)

[9] = = Array
(
)

[Ten] + = Array
(
)

[one] = = Array
(
)

[+] = Array
(
[0] = = Array
(
[id] = 42
[PID] = 0-9-38
[Name] + high-handed Hall
[HREF] =
[Date] = =
)

)

)


Reply to discussion (solution)

Smarty foreach

Smarty foreach
I know that, but the three-dimensional array won't get it!

To the effect of this

To the effect of this


{foreach Item=lop key=k name=loop from= $dao}              
  • {$dao [$k].name} {foreach Item=lop2 key=kk name=loop1 from= $dao 1} {if $k = = $kk && $dao 1[$kk]| @count neq 0}
      {foreach item=lop3 key=kkk from= $lop 2}
    • {$lop 3.name} {foreach Item=lop4 key=kkkk from= $dao 2} {if $dao 2[$kkk]| @count NEQ 0} {foreach item=lop5 name=app key=kkkkk from= $lop 4} {if $lop 5.pid=== $lop 3.pid|cat: "-" |cat: $lop 3.id} {if $smarty. foreach.app.index==0}
        {/if}
      • {$lop 5.name}
      • {if $smarty. foreach.app.iteration== $lop 4| @count}
      {/if} {/if} {/foreach} {/if} {/foreach}
    • {/foreach}
    {/if} {/foreach}
  • {/foreach}
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.