Changeset 11155 for trunk/include/functions_category.inc.php
- Timestamp:
- May 31, 2011, 10:25:40 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions_category.inc.php
r8802 r11155 534 534 return $image_id; 535 535 } 536 537 /** 538 * create a tree from a flat list of categories, no recursivity for high speed 539 */ 540 function categories_flatlist_to_tree($categories) 541 { 542 $tree = array(); 543 $key_of_cat = array(); 544 545 foreach ($categories as $key => &$node) 546 { 547 $key_of_cat[$node['id']] = $key; 548 549 if (!isset($node['id_uppercat'])) 550 { 551 $tree[$key] = &$node; 552 } 553 else 554 { 555 if (!isset($categories[ $key_of_cat[ $node['id_uppercat'] ] ]['sub_categories'])) 556 { 557 $categories[ $key_of_cat[ $node['id_uppercat'] ] ]['sub_categories'] = array(); 558 } 559 560 $categories[ $key_of_cat[ $node['id_uppercat'] ] ]['sub_categories'][$key] = &$node; 561 } 562 } 563 564 return $tree; 565 } 536 566 ?>
Note: See TracChangeset
for help on using the changeset viewer.