[eluser]joneslee[/eluser]
I have an array of category tree as below:
Code:
Array
(
[0] => Array
(
[0] => stdClass Object
(
[id] => 77
[modified] => 2009-01-23 20:44:28
[created] => 2009-01-23 00:00:00
[parent_id] => 0
[name] => stock availabity
[has_child] => 1
[num_items] => 0
[ordering] => 0
[hidden] => 0
)
[1] => stdClass Object
(
[id] => 78
[modified] => 2009-01-23 20:57:24
[created] => 2009-01-23 12:00:00
[parent_id] => 0
[name] => catalogs
[has_child] => 1
[num_items] => 0
[ordering] => 0
[hidden] => 0
)
[2] => stdClass Object
(
[id] => 79
[modified] => 2009-01-23 20:57:53
[created] => 2009-01-28 13:39:45
[parent_id] => 0
[name] => product images
[has_child] => 0
[num_items] => 0
[ordering] => 0
[hidden] => 0
)
[3] => stdClass Object
(
[id] => 80
[modified] => 2009-01-28 13:39:54
[created] => 2009-01-28 13:39:54
[parent_id] => 0
[name] => magazine ads
[has_child] => 0
[num_items] => 0
[ordering] => 0
[hidden] => 0
)
[4] => stdClass Object
(
[id] => 81
[modified] => 2009-01-28 13:40:04
[created] => 2009-01-28 13:40:04
[parent_id] => 0
[name] => brand logos
[has_child] => 0
[num_items] => 0
[ordering] => 0
[hidden] => 0
)
)
[77] => Array
(
[0] => stdClass Object
(
[id] => 83
[modified] => 2009-01-28 13:42:06
[created] => 2009-01-28 13:42:06
[parent_id] => 77
[name] => UK Distributors Stock Availability
[has_child] => 1
[num_items] => 0
[ordering] => 0
[hidden] => 0
)
[1] => stdClass Object
(
[id] => 89
[modified] => 2009-02-05 22:13:05
[created] => 2009-02-05 22:13:05
[parent_id] => 77
[name] => US Distributors Stock Availability
[has_child] => 0
[num_items] => 1
[ordering] => 0
[hidden] => 0
)
)
[78] => Array
(
[0] => stdClass Object
(
[id] => 84
[modified] => 2009-02-04 11:01:54
[created] => 2009-02-04 11:01:54
[parent_id] => 78
[name] => Summer 2009
[has_child] => 0
[num_items] => 0
[ordering] => 0
[hidden] => 0
)
)
[80] => Array
(
[0] => stdClass Object
(
[id] => 86
[modified] => 2009-02-04 14:45:34
[created] => 2009-02-04 14:45:34
[parent_id] => 80
[name] => April 2009
[has_child] => 0
[num_items] => 0
[ordering] => 0
[hidden] => 0
)
)
[83] => Array
(
[0] => stdClass Object
(
[id] => 90
[modified] => 0000-00-00 00:00:00
[created] => 0000-00-00 00:00:00
[parent_id] => 83
[name] => testing level 2
[has_child] => 0
[num_items] => 0
[ordering] => 0
[hidden] => 0
)
)
[90] => Array
(
[0] => stdClass Object
(
[id] => 91
[modified] => 0000-00-00 00:00:00
[created] => 0000-00-00 00:00:00
[parent_id] => 90
[name] => testing level 3
[has_child] => 0
[num_items] => 0
[ordering] => 0
[hidden] => 0
)
)
)
They are the categories tree data that I would like to take use of. I would like to create directory tree out of their ID hierarhcally. eg
0 ---- 77 ------------------- 83 ------- 90 -------- 91
|___ 78 -----84 |__ 89
|___ 79
|____ 80 ------ 86
|____ 81
basically I got recursive_mkdir() function working already, just wondering if someone can help me how to recusively goes through that array to create recursive dirs
Many thanks,