<?php $pages = array( 'PAGE1' => 'FIRST PAGE', 'PAGE2' => 'SECOND PAGE'); ?> <ul class="nav"> <?php foreach ($pages as $pageId => $pageTitle): ?> <li <?=(($_GET['pg'] == $pageId) ? 'class="active"' : '')?>><a href="?pg=<?=$pageId?>"><?=$pageTitle?></a></li> <?php endforeach; ?> </ul>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter