Browser History Utility: Simple Navigation Bar
This example demonstrates how to use the Browser History Utility to "ajaxify" a simple navigation bar.
Basic markup
<!doctype html> <html> <head> <title>YUI Browser History Utility - Simple Navigation Bar Example</title> </head> <body> <div id="doc"> <div id="hd"> <h3>Navigation Links</h3> <div id="nav"> <ul> <li><a href="?section=home">Home</a></li> <li><a href="?section=overview">Overview</a></li> <li><a href="?section=products">Products</a></li> <li><a href="?section=contactus">Contact Us</a></li> </ul> </div> </div> <div id="bd"> <? $section = "home"; $sections = array("home", "overview", "products", "contactus"); if (isset($_GET["section"]) && in_array($_GET["section"], $sections)) { $section = $_GET["section"]; } include($section . ".php"); ?> </div> <div id="ft">YUI Browser History Utility - Simple Navigation Bar Example</div> </div> </body> </html>
<!doctype html> <html> <head> <title>YUI Browser History Utility - Simple Navigation Bar Example</title> </head> <body> <div id="doc"> <div id="hd"> <h3>Navigation Links</h3> <div id="nav"> <ul> <li><a href="?section=home">Home</a></li> <li><a href="?section=overview">Overview</a></li> <li><a href="?section=products">Products</a></li> <li><a href="?section=contactus">Contact Us</a></li> </ul> </div> </div> <div id="bd"> <? $section = "home"; $sections = array("home", "overview", "products", "contactus"); if (isset($_GET["section"]) && in_array($_GET["section"], $sections)) { $section = $_GET["section"]; } include($section . ".php"); ?> </div> <div id="ft">YUI Browser History Utility - Simple Navigation Bar Example</div> </div> </body> </html>
YUI Browser History Utility - Simple Navigation Bar Example