Reputation: 667
i'm looking to take some html, mainly the navigation bar and code:
<div id="navbar">
<ul>
<li><a href="">Buy</a></li>
<li><a href="">Lookbook</a></li>
<li><a href="">About</a></li>
<li><a href="">Contact</a></li>
</ul>
</div>
and insert it on every page on a given site. how would i do this so that when i make changes it reflects on all the pages, so i don't have to copy and paste the changes on each page.
Upvotes: 1
Views: 4677
Reputation: 436
Creater a header page! Create a new page with the .php extension. For this example, call it someheader.php
Include the following code in every new .php file between the <html>
tags:
<php
include('someheader.php');
?>
This saves time since it won't be neccessary to retype the same code over and over.
Upvotes: 0
Reputation: 46
Upvotes: 2
Reputation: 5581
One way is to have your pages in PHP and include a common file into each of them. That would let you make changes to your navbar and all pages would pick them up. It would require changing your pages to PHP and adding appropriate include statements in each though.
Upvotes: 0