$c = str_replace(QUOTE, APOS, $c);
    $c = strip_tags($c);
    $menu .= ",\"" . $c . "\"" . RPAREN . SEMI_COLON . NEW_LINE;
    echo $menu;
}
$depth = 0;
$blank_length = 0;
$depth_size = array();
$depth_parentid = array();
$top_level_items = 0;
$depth_text = 'depth';
$text_text = 'text';
$id_text = 'id';
echo NEW_LINE;
for ($i = 0; $i < count($menu_entries); $i++) {
    $blank_length = blank_length($menu_entries[$i][$text_text]);
    if ($blank_length == $depth) {
        $menu_entries[$i][$depth_text] = $depth;
        $depth_size[$depth]++;
    } else {
        if ($blank_length > $depth) {
            $depth++;
            $menu_entries[$i][$depth_text] = $depth;
            $depth_size[$depth]++;
        } else {
            for ($j = $depth; $j > $blank_length; $j--) {
                $depth_size[$j] = 0;
                $depth--;
            }
            $menu_entries[$i][$depth_text] = $depth;
            $depth_size[$depth]++;
Exemplo n.º 2
0
    for ($i = 0; $i < $size - 1; $i++) {
        $cPathNew .= $depth_size[$i] != 0 ? $depth_parentid[$i] . '_' : '';
    }
    $cPathNew .= $categories['id'];
    echo "','" . olc_href_link(FILENAME_DEFAULT, $cPathNew) . "')\n";
}
// ---
$categories = olc_get_categories('');
$height .= 2.65 * count($categories);
$depth = 0;
$blank_length;
$depth_size;
$depth_parentid;
for ($i = 0; $i < count($categories); $i++) {
    // don't insert 1st entry ("please choose ...")
    $blank_length = blank_length($categories[$i]['text']);
    if ($blank_length == $depth) {
        $categories[$i]['depth'] = $depth;
        $depth_size[$depth]++;
    } else {
        if ($blank_length > $depth) {
            $depth++;
            $categories[$i]['depth'] = $depth;
            $depth_size[$depth]++;
        } else {
            if ($blank_length < $depth) {
                for ($j = $depth; $j > $blank_length; $j--) {
                    $depth_size[$j] = 0;
                    $depth--;
                }
                $categories[$i]['depth'] = $depth;