Leeoniya
05-20-2008, 08:38 PM
If someone can provide a sample of how to recursively process arrays between 2 specified depth levels.
eg:
$myArr = array(
array(
myText1,
myText2,
array(
text1,
text2,
array(
yourText1,
yourText2
)
)
),
array(
myText3,
myText4,
array(
text3,
text4,
array(
yourText3,
yourText4
)
)
)
)
how would i iterate through the arrays containing text1...etc and yourText1 etc...given a starting level depth of 2 and an unspecified ending level.
also how would i process only arrays containing myText1...etc, by specifying a starting depth of 1 and ending depth of 1.
the ultimate goal is to build a nested UL nav menu from a sitemap, but have the ability to limit the scope/depth, so that deeper menus can be split off and built somewhere else on the page.
thanks,
Leon
eg:
$myArr = array(
array(
myText1,
myText2,
array(
text1,
text2,
array(
yourText1,
yourText2
)
)
),
array(
myText3,
myText4,
array(
text3,
text4,
array(
yourText3,
yourText4
)
)
)
)
how would i iterate through the arrays containing text1...etc and yourText1 etc...given a starting level depth of 2 and an unspecified ending level.
also how would i process only arrays containing myText1...etc, by specifying a starting depth of 1 and ending depth of 1.
the ultimate goal is to build a nested UL nav menu from a sitemap, but have the ability to limit the scope/depth, so that deeper menus can be split off and built somewhere else on the page.
thanks,
Leon