Ejemplo n.º 1
0
function navigation_print_level($tree)
{
    echo '<ul>';
    foreach ($tree as $item) {
        printf('<li><a href="/%s">%s</a>', $item->attr->id, $item->data);
        if (isset($item->children)) {
            navigation_print_level($item->children);
        }
        echo '</li>';
    }
    echo '</ul>';
}
Ejemplo n.º 2
0
/**
 * Prints the site tree for the navigation/dropmenu handler.
 */
function navigation_print_dropmenu($tree, $id = false)
{
    if ($id) {
        echo '<ul id="' . $id . '" class="dropmenu">';
    } else {
        echo '<ul class="dropmenu">';
    }
    foreach ($tree as $item) {
        $current = $item->attr->id == Link::current() ? ' class="current"' : '';
        if (empty($current)) {
            $current = in_array($item->attr->id, Link::active()) ? ' class="active"' : $current;
        }
        echo '<li' . $current . '>' . Link::make($item->attr->id, $item->data);
        if (isset($item->children)) {
            navigation_print_level($item->children);
        }
        echo '</li>';
    }
    echo '</ul>';
}
Ejemplo n.º 3
0
<?php

/**
 * Displays a complete site map as a multi-level
 * bulleted list.
 *
 * In PHP code, call it like this:
 *
 *     echo $this->run ('navigation/map');
 *
 * In a template, call it like this:
 *
 *     {! navigation/map !}
 *
 * Also available in the dynamic objects menu as "Navigation: Site Map".
 */
$n = Link::nav();
require_once 'apps/navigation/lib/Functions.php';
if (conf('I18n', 'multilingual')) {
    $section = $n->node($i18n->language);
    if (is_array($section->children)) {
        navigation_print_level($section->children);
    }
} else {
    navigation_print_level($n->tree);
}