0
PHP: Nested repeat region in nested repeat region
New Here
,
/t5/dreamweaver-discussions/php-nested-repeat-region-in-nested-repeat-region/td-p/578043
Jun 23, 2006
Jun 23, 2006
Copy link to clipboard
Copied
Does anyone know how to this:
I wanna have nested repeat region in repeated region. Example
Parent Category
Category name
Category name
Category name
Parent Category
Category name
sub category name
sub category name
sub category name
Category name
Category name
sub category name
sub category name
sub category name
Parent Category
Parent Category
Parent Category
Can anyone help me with this?
Thanks in advance.
I wanna have nested repeat region in repeated region. Example
Parent Category
Category name
Category name
Category name
Parent Category
Category name
sub category name
sub category name
sub category name
Category name
Category name
sub category name
sub category name
sub category name
Parent Category
Parent Category
Parent Category
Can anyone help me with this?
Thanks in advance.
TOPICS
Server side applications
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/dreamweaver-discussions/php-nested-repeat-region-in-nested-repeat-region/m-p/578044#M188327
Jun 23, 2006
Jun 23, 2006
Copy link to clipboard
Copied
dreamworms wrote:
> I wanna have nested repeat region in repeated region.
I'm not saying it's necessarily the best way to do it, but this is
certainly one way. The categories are stored as a multidimensional,
associative array. Each element needs to be an array, even if it's
empty. The recursive function displayCats() then loops through the whole
thing and produces the nested results you seek.
<?php
$cats = array('Top Level 1' => array(
'sub a' => array(), 'sub b' => array(), 'sub c' => array()),
'Top Level 2' => array(
'sub d' => array(
'sub sub a' => array(), 'sub sub b' => array()),
'sub e' => array(
'sub sub c' => array(), 'sub sub d' => array()),
'sub f' => array(
'sub sub e' => array(), 'sub sub f' => array(), 'sub sub g' =>
array())),
'Top Level 3' => array(),
'Top Level 4' => array(),
'Top Level 5' => array());
function displayCats($array) {
echo "<ul>\n";
foreach ($array as $key => $value) {
echo "<li>$key</li>\n";
if ($value) {
displayCats($value);
}
}
echo "</ul>\n";
}
displayCats($cats);
?>
--
David Powers
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "Foundation PHP 5 for Flash" (friends of ED)
http://foundationphp.com/
> I wanna have nested repeat region in repeated region.
I'm not saying it's necessarily the best way to do it, but this is
certainly one way. The categories are stored as a multidimensional,
associative array. Each element needs to be an array, even if it's
empty. The recursive function displayCats() then loops through the whole
thing and produces the nested results you seek.
<?php
$cats = array('Top Level 1' => array(
'sub a' => array(), 'sub b' => array(), 'sub c' => array()),
'Top Level 2' => array(
'sub d' => array(
'sub sub a' => array(), 'sub sub b' => array()),
'sub e' => array(
'sub sub c' => array(), 'sub sub d' => array()),
'sub f' => array(
'sub sub e' => array(), 'sub sub f' => array(), 'sub sub g' =>
array())),
'Top Level 3' => array(),
'Top Level 4' => array(),
'Top Level 5' => array());
function displayCats($array) {
echo "<ul>\n";
foreach ($array as $key => $value) {
echo "<li>$key</li>\n";
if ($value) {
displayCats($value);
}
}
echo "</ul>\n";
}
displayCats($cats);
?>
--
David Powers
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "Foundation PHP 5 for Flash" (friends of ED)
http://foundationphp.com/
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
LATEST
/t5/dreamweaver-discussions/php-nested-repeat-region-in-nested-repeat-region/m-p/578045#M188328
Jun 23, 2006
Jun 23, 2006
Copy link to clipboard
Copied
Tom Muck has a free extension that will do what you require:
http://www.tom-muck.com/extensions/help/simulatednestedregion/
--
Dave Buchholz
I-CRE8
www.i-cre8.co.uk
"dreamworms" <dreamworms@siteatelier.com> wrote in message
news:e7gacv$fc5$1@forums.macromedia.com...
Does anyone know how to this:
I wanna have nested repeat region in repeated region. Example
Parent Category
Category name
Category name
Category name
Parent Category
Category name
sub category name
sub category name
sub category name
Category name
Category name
sub category name
sub category name
sub category name
Parent Category
Parent Category
Parent Category
Can anyone help me with this?
Thanks in advance.
http://www.tom-muck.com/extensions/help/simulatednestedregion/
--
Dave Buchholz
I-CRE8
www.i-cre8.co.uk
"dreamworms" <dreamworms@siteatelier.com> wrote in message
news:e7gacv$fc5$1@forums.macromedia.com...
Does anyone know how to this:
I wanna have nested repeat region in repeated region. Example
Parent Category
Category name
Category name
Category name
Parent Category
Category name
sub category name
sub category name
sub category name
Category name
Category name
sub category name
sub category name
sub category name
Parent Category
Parent Category
Parent Category
Can anyone help me with this?
Thanks in advance.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

