/** * Render GNB * * @param array $o * @param int $depth * @return string */ function renderGNB($o, $depth) { $result = '<div><ul class="dep-' . $depth . '">'; foreach ($o as $k => $v) { $url = $v['external'] ? $v['url'] : __ROOT__ . $v['url']; $url = $v['url'] != '#' ? $url : 'javascript:;'; $target = $v['target'] ? 'target="' . $v['target'] . '"' : ''; $active = preg_match("|" . preg_quote($v['url']) . "|", $_SERVER['REQUEST_URI'], $arr) ? 'class="active"' : ''; $result .= "<li {$active}>"; $result .= "<a href=\"{$url}\" {$target}>{$v['name']}</a>"; $result .= count($v['children']) ? renderGNB($v['children'], $depth + 1) : ''; $result .= '</li>'; } $result .= '</ul></div>'; return $result; }
<legend class="blind">keyword search form</legend> <input type="text" name="keyword" placeholder="Keyword" maxlength="15" value=""> <button type="submit" title="search"> <i class="fa fa-search"></i> </button> </fieldset> </form> <nav class="profile"> <button type="button"> <span class="blind">toggle profile</span> <i class="fa fa-user"></i> <i class="fa fa-angle-down"></i> </button> <div class="dropdown"> <?php echo count($pref->json['navigation']['profile']) ? renderGNB($pref->json['navigation']['profile'], 1) : ''; ?> </div> </nav> </header> <div class="container"> <?php if (file_exists($loc_container)) { require_once $loc_container; } ?> </div> <footer class="footer" id="footer"> <p><?php
<legend class="blind">keyword search form</legend> <input type="text" name="keyword" placeholder="Keyword" maxlength="15" value=""> <button type="submit" title="search"> <i class="fa fa-search"></i> </button> </fieldset> </form> <nav class="profile"> <button type="button"> <span class="blind">toggle profile</span> <i class="fa fa-user"></i> <i class="fa fa-angle-down"></i> </button> <div class="dropdown"> <?php echo count($gnb->json['profile']) ? renderGNB($gnb->json['profile'], 1) : ''; ?> </div> </nav> </header> <div class="container"> <?php if (file_exists($loc_container)) { require_once $loc_container; } ?> </div> <footer class="footer" id="footer"> <p><?php