Forumlar / National / Russian / Переменная считающая вложнность категории

Oughtem
#35032 2012-07-28 18:55

У меня есть такой вариант:

PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$list_path_code = explode('.', $structure['page'][$c]['path']);
$list_parent_code1 = $list_path_code[count($list_path_code)-1];
$list_parent_code2 = $list_path_code[count($list_path_code)-2];
$list_parent_code3 = $list_path_code[count($list_path_code)-3];
$list_parent_code4 = $list_path_code[count($list_path_code)-4];
$list_parent_code5 = $list_path_code[count($list_path_code)-5];
$list_parent_code6 = $list_path_code[count($list_path_code)-6];
$list_parent_code7 = $list_path_code[count($list_path_code)-7];
 
$t->assign(array(
    "LIST_PARENT_CODE1" => $list_parent_code1,
    "LIST_PARENT_CODE2" => $list_parent_code2,
    "LIST_PARENT_CODE3" => $list_parent_code3,
    "LIST_PARENT_CODE4" => $list_parent_code4,
    "LIST_PARENT_CODE5" => $list_parent_code5,
    "LIST_PARENT_CODE6" => $list_parent_code6,
    "LIST_PARENT_CODE7" => $list_parent_code7,
));

Он высчитывает родительские категории, но вывести именно число, которое бы обозначало количество категорий от основной, он не может. Как дописать? Хелп плиз.