Adding navigation to your web pages with one line of php code
Ok so fist time i learned html i added all the nav code to all of my pages , BIG MISTAKE from now on i just create one html file containing my <NAV> and one PHP file for the page i use .
then i include my nav.html into my php file
(NOTE : im a newbie this is the way i know and i assure you there are alot more ways but this one of them )
here is the code you have to write :
NAV.HTML /*this is the fhtml file you create youre nav in , inside notepad
<nav>
<ul>
<li><a href="home.php"></a></li>
<li><a href="Contact us.php"></a></li>
<li><a href="About us.php"></a></li>
</ul>
</nav>
Home.PHP: // your first website page
<!DOCTYPE HTML>
<html>
<body>
<? php
include_once "NAVHTML";
?>
</body>
</html>
now you can include your nav in all of your pages with one line ,
NOTE : this is the CORE code you have to add css for design and other stuff
then i include my nav.html into my php file
(NOTE : im a newbie this is the way i know and i assure you there are alot more ways but this one of them )
here is the code you have to write :
NAV.HTML /*this is the fhtml file you create youre nav in , inside notepad
<nav>
<ul>
<li><a href="home.php"></a></li>
<li><a href="Contact us.php"></a></li>
<li><a href="About us.php"></a></li>
</ul>
</nav>
Home.PHP: // your first website page
<!DOCTYPE HTML>
<html>
<body>
<? php
include_once "NAVHTML";
?>
</body>
</html>
now you can include your nav in all of your pages with one line ,
NOTE : this is the CORE code you have to add css for design and other stuff
Comments
Post a Comment