Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Numero sconosciuto di Sezioni Nidificate

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: Italian
View previous topic :: View next topic  
Author Message
mikemad
Smarty n00b


Joined: 25 Sep 2008
Posts: 2

PostPosted: Thu Sep 25, 2008 8:37 am    Post subject: Numero sconosciuto di Sezioni Nidificate Reply with quote

Salve a tutti!!! Ho un gratta capo che non riesco a risolvere!!!!

Ho un array multidimensionale che contiene la struttura di categorie e sottocategorie del sito a cui sto lavorando .... vi faccio un esempio (var_dump dell'array) ...

Code:

array(2) {
  [0]=>
  array(4) {
    ["id"]=>
    string(1) "2"
    ["nome"]=>
    string(17) "Prima Categoria di Test"
    [0]=>
    array(3) {
      ["id"]=>
      string(1) "4"
      ["nome"]=>
      string(32) "Prima Sotto Categoria di Test"
      [0]=>
      array(2) {
        ["id"]=>
        string(1) "5"
        ["nome"]=>
        string(11) "Prima Sotto Sotto Categoria di Test"
      }
    }
    [1]=>
    array(2) {
      ["id"]=>
      string(1) "6"
      ["nome"]=>
      string(13) "Seconda Sotto Categoria di Test"
    }
  }
  [1]=>
  array(2) {
    ["id"]=>
    string(1) "3"
    ["nome"]=>
    string(25) "Seconda Categoria di Test"
  }
}


semplificando:

Code:

Prima Categoria di Test
-> Prima Sotto Categoria di Test
     -> Prima Sotto Sotto Categoria di Test
-> Seconda Sotto Categoria di Test
Seconda categoria di Test


questo array non è mai uguale, poichè la struttura è modificabile dal cliente tramite la sua interfaccia di amministrazione ... ora vorrei mostrarle in una tabella nella pagina di amministrazione del sito ... ho provato con tutto ... section o foreach nidificati .. ma niente ... non riesco .... qualcuno ha un idea??? di seguito in codice usato

Code:

{foreach from=$elementi item=elemento name=i}     
 
<div>
{$elemento.nome}
       {foreach from=$elemento item=elemento_interno}
           
             <div> -> {include file="sottocategorie.tpl"}</div>

        {/foreach}
</div>
   
{foreachelse}
        Nessuna <strong>Categoria</strong> presente.
{/foreach}



e il file sottocategorie.tpl

Code:

 
{$elemento_interno.nome}
       
       {foreach from=$elemento_interno item=elemento_interno}
           
             <div> -> {include file="sottocategorie.tpl"} </div>

        {/foreach}



Ho semplificato il codice mettendo i div invece delle tabelle ... per renderlo più leggibile,ma il succo è lo stesso .... chi mi da una mano????

Grazie Mike
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: Italian All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP