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

section oder foreach ?!

 
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: German
View previous topic :: View next topic  
Author Message
m0rd*
Smarty n00b


Joined: 27 Jul 2004
Posts: 3

PostPosted: Tue Jul 27, 2004 12:13 am    Post subject: section oder foreach ?! Reply with quote

hallo leute... ich muss leider zugeben dass ich recht neu in der smartywelt bin aber hellauf begeistert davon bin. zudem habe ich mit multidimensionalen arrays noch nicht sooo viel gemacht... nun haperts leider etwas bei der umsetzung eines array wo ich nicht so genau weiß wie ich das verschachteln muss. Das ganze ist für ein kleines forensystem gedacht mit kategorien und darin befindlichen unterforen die dann die thread beinhalten.... hier das array

Code:
Array
(
    [0] => Array
        (
            [0] => 1
            [id] => 1
            [1] => Computer
            [name] => Computer
        )

    [Computer] => Array
        (
            [0] => Array
                (
                    [0] => 2
                    [id] => 2
                    [1] => 1
                    [subforum] => 1
                    [2] => Internetpräsentation
                    [name] => Internetpräsentation
                    [3] => Fragen zu Internetseitengestaltung oder Vorstellung einer Internetseite.
                    [beschreibung] => Fragen zu Internetseitengestaltung oder Vorstellung einer Internetseite.
                )

            [1] => Array
                (
                    [0] => 3
                    [id] => 3
                    [1] => 1
                    [subforum] => 1
                    [2] => ProgrammiererForum
                    [name] => ProgrammiererForum
                    [3] => Fragen zur Erstellung von dynamischen Webseiten. (PHP,CGI,ASP,SQL,...)
                    [beschreibung] => Fragen zur Erstellung von dynamischen Webseiten. (PHP,CGI,ASP,SQL,...)
                )

        )
...

ich habe das ganze so aufgebaut dass 0 hier die erste kategorie ist und das array "Computer" die Unterforen beinhaltet. also das array trägt immer den namen der Kategorie...
mir ist nun klar dass ich 2 gekapselte schleifen brauche aber wie muss ich die aufbauen?

folgendes funktioniert leider nicht wirklich Sad

Code:

{foreach item=foren from=$gf_index}
                ~ <b>{$foren.name}</b><p>
            {foreach key=schluessel item=subforen from=$foren.name}
...
{/foreach}{/foreach}

wenn mehr infos benötigt werden bitte bescheit geben...
big thx im voraus!


eigentlich müsste es ja dann heißen from $gf_index.$foren.name
aber das funktioniert irgendwie nicht bei smarty
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: German 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