EMB Elizabeth Best's professional logo

Elizabeth M Best

Web Portfolio

Elizabeth Best's portrait

Portfolio Code Snips - Navigation

MainNav_sample.php File


<!--
*** CODE SAMPLE: NAVIGATION MENU SEGMENT ***
Created by Elizabeth Best

For how and where to use this code, please see 'index_sample.php'.

Here is where the code segments really shine vs. plain HTML, you have only ONE place[*] where you need to change your links if you update the site! 

Set up your navigation as you would normally in HTML, execpt make you sure you take note of how PHP is used in the href links.
[*]NOTE: That is if you do not use submenus in any form, including in the footer.

-->

<nav class="myNavstyles"> <!-- HTML nav tag -->
	<ul>
		<li class="linksStyle homePg"><a href="<?php echo DOC_ROOT //the constant was defined in the config file ?>" >Home</a></li> <!--Home page link-- >

		<li class="linksStyle"><a href="<?php echo DOC_ROOT.'about.php'?>" >About</a></li>  <!--About page link-- >

		<li class="linksStyle"><a href="<?php echo DOC_ROOT.'firstLevelMenuItem/'?>" >First Level</a> <!-- use an 'index.php' page for this page --> 
			<ul class="secondLevelLinkStyle">  <!-- lower level menu items-->
				<li><a href="<?php echo DOC_ROOT.'firstLevel/2ndLevelItemOne.php'?>" >Item One</a></li>  
				<li><a href="<?php echo DOC_ROOT.'firstLevel/2ndLevelItemTwo.php'?>" >Item Two</a></li>
				<li><a href="<?php echo DOC_ROOT.'firstLevel/2ndLevelItemThree.php'?>" >Item Three</a></li>
			</ul>
		</li>  <!-- end of First Level (with lower level) page links -->
		<li class="linksStyle"><a href="<?php echo DOC_ROOT.'contact.php' ?>" >Contact</a></li>  <!--Contact page link-- >
	</ul>
</nav>