Smarty İç içe foreach döngüsü soru

0 Cevap php

Ben sorun altında dizi smarty şablon dosyasında düzgün görüntülemek için alıyorum yaşıyorum. Herkes bana doğru yönde işaret yardımcı olabilir ben çok müteşekkir olacaktır.

benim şablon kod şöyle görünür:

          {foreach from=$trackingGroups item=gender key=k item=v}
          {assign var=tc value="`$v.id`"}    
          {$v.title} ({$v.productCount})<br />

{foreach item=department from=$trackingGroups.$tc item=v2} {$v2.title}
{/foreach} {/foreach}

ancak sayfa aşağıdaki gibi görüntüler:

          Women (3)<br />
           W<br />
                    7<br />
                    3<br />
                    Footwear<br />
                    Accessories<br />

          Men (2)<br />
           M<br />
                    7<br />
                    2<br />
                    Footwear<br />




Array

( [71] => Array ( [title] => Women [id] => 71 [productCount] => 3 [171] => Array ( [id] => 171 [title] => Footwear [productCount] => 2 [74] => Array ( [id] => 74 [title] => Boots [productCount] => 2 )

            )

        [172] => Array
            (
                [id] => 172
                [title] => Accessories
                [productCount] => 1
                [74] => Array
                    (
                        [id] => 74
                        [title] => Boots
                        [productCount] => 1
                    )

            )

    )

[72] => Array
    (
        [title] => Men
        [id] => 72
        [productCount] => 2
        [171] => Array
            (
                [id] => 171
                [title] => Footwear
                [productCount] => 2
                [74] => Array
                    (
                        [id] => 74
                        [title] => Boots
                        [productCount] => 2
                    )

            )

    )

)

0 Cevap