A version of the function with a fourth option, to expand the active tree only to subs of cats in $cPath. Inactive cats are subject to level control settings.
PHP Code:
/* Categories Dressing v2.7.1 - Glenn Herbert (gjh42) - 20090308 (new active option 4)
*/
function cat_active_level_manage($path) {
$skip_cat = 0;
if (defined('CAT_BOX_ACTIVE_LEVEL')) {
$cat_box_active_level = explode('|',constant('CAT_BOX_ACTIVE_LEVEL'));
$cPath_top = (int)$_GET['cPath'];
$path_top = (int)$path;
$cat_depth = substr_count($path,'_');
//tests for various kinds of skipping - more can be added
switch ('true'){
case ($cat_box_active_level[0] == 1 and $cPath_top != $path_top):
$skip_cat = 1;
break;
case ($cat_box_active_level[0] == 2 and $cPath_top != $path_top and $cPath_top != 0):
$skip_cat = 1;
break;
case ($cat_box_active_level[0] == 3):
if($cPath_top == $path_top) break;//otherwise check levels
case ($cat_box_active_level[0] == 4):
if($cPath_top == $path_top){
if ($cat_depth >= 2){//only test sub-subcats+
$path_ids = explode('_',$path);
$path_parent = $path_ids[count($path_ids)-2];
if (!in_array($path_parent,explode('_',$_GET['cPath']))) $skip_cat = 1;//show only subcats w parent in $cPath
}
break;
}//if not active test for level
case ($cat_box_active_level[1] > $cat_depth):
$skip_cat = 1;
break;
case ($cat_box_active_level[2] < $cat_depth):
$skip_cat = 1;
break;
}//switch
}//defined
return $skip_cat;
}
Set the first field in the define to 4.
Bookmarks