As I have created more websites, I have come to love includes. They are useful when you need to use one file repeatadly. For instance, you may want the same navigation scheme across a site. It would be troublesome, or bothersome to insert you navigation code on each page.
What happens when you add or subtract a page? You would have to change every single page. 9 times out of 10, you always miss at least one page. There are other situations where using an include would come in handy, but those are more programming oriented.
You will need:
- PHP (in this case), or ASP based server
- Main Page
- Navigation Page
This code requires the use of PHP, on the main page you need to write, and so this page must end in .php, for example, index.php. The ending php tells your server it needs to do more work with that page before displaying it.
Whenever you are using a PHP tag, you must enclose it in
<?php **Place Code Here** ?>
On the every page you want this content to appear insert the code:
<?php include(“file directory here/link.html”); ?>
This tells the server to include “file.html” in that place on the page. Now, you create “link.html”.
<li><a href=”index.php” title=”Home”>Home</a></li>
<li><a href=”contact.php” title=”Contact Us”>Contact Us</a></li>
<li><a href=”location.php” title=”Location”>Location</a></li>
Now upload these pages to your webserver and only update “link.html” as needed.
Comments Off on Easy Site-Wide Link Updating
Many people who design websites put copyright dates on every page of their website. By inserting this snippet of code your site will bringing in the new year with an up to date copyright date.
Today this snippet will output Copyright 2008 Resnodesigns and next year, it will greet the New Year with Copyright 2009 Resnodesigns.
Copyright <? echo date("Y"); ?> Resnodesigns
Comments Off on Automatic Copyright Updating