function showChildren_responsive($area, $itemsSlug, $items) { $areas = $area['__children']; foreach ($areas as $area) { /* S'il existe un item qui porte le meme slug qu'un menu, on utilise cet item */ if (in_array($area['slug'], $itemsSlug->getRawValue())) { /* On récupère la clé pour taper dans le 2e tableau */ $key = array_search($area['slug'], $itemsSlug->getRawValue()); /* On test si c'est un lien ou une page */ if ($items[$key]['type'] == 'link') { echo '<option value="' . $items[$key]['url'] . '">' . str_repeat('-', $area['level']) . ' ' . $area['name'] . '</option>'; } else { echo '<option value="' . url_for('item_show', array('slug' => $items[$key]['slug'], 'sf_format' => 'html')) . '">' . str_repeat('-', $area['level']) . ' ' . $area['name'] . '</option>'; } /* Sinon on affiche par défaut */ } else { echo '<option value="' . url_for('article_by_category_list', array('category' => $area['slug'], 'sf_format' => 'html')) . '">' . str_repeat('-', $area['level']) . ' ' . $area['name'] . '</option>'; } showChildren_responsive($area, $itemsSlug, $items); } }
$areas_responsive = $menus; ?> <select class="chzn-select"> <?php foreach ($areas_responsive as $area_responsive) { ?> <option value="<?php echo url_for('article_by_category_list', array('category' => $area['slug'], 'sf_format' => 'html')); ?> "> <?php echo $area_responsive['name']; ?> </option> <?php showChildren_responsive($area_responsive, $itemsSlug, $items); ?> <?php } ?> </select> </form> </div> <div class="four columns omega align-right" id="tagline"> <ul class="social"> <?php foreach ($social as $rs) { ?>