Including common files in your pageA very useful technique for making it easier to create web sites is to have common elements such as menus, headers and footers in separate files which are then included into your main web pages. This has a number of advantages.
Below is a simplified version of what my menu-links.inc contains. Each time I update the menu all the pages on this site are automatically updated.<?php include_once('menu-links.inc'); ?>
<a href="/"> <img src="/advancedhtml.gif"> </a> <p> <font size="-1" face="arial"> <a href="/advancedhtml.htm">Advanced HTML</a><br> <a href="/tables.htm">Tables</a><br> <a href="/frame.htm">Frames</a><br> <a href="/password.htm">Passwords</a><br> <a href="/colours.htm">HTML Colours</a><br> <a href="/webspace.htm">Buying Webspace</a><br> </font> </p>
For this to work you just need menu-links.inc to be in the same directory as your .html or .php files.
If you are going to be including a menu from many different directories then it may be better to include a full path to the menu file. If you are using an Apache web server you may be able to do this by using the
<?php include_once($_SERVER['DOCUMENT_ROOT'] . '/menu-links.inc'); ?>
Keeping your copyright footer up to date automaticallyImagine that in 2007 you create a webpage and you add a copyright footer. Time passes and we reach 2008. The problem is that your copyright footer is now out of date. There is an easy way to sort this out. Use some simple PHP to keep the current year up to date.
If the current year is 2021 then the output will be 'Copyright © 1997 - 2021'.<center> <font size="-2" face="arial"> <?php $today = getdate(); print "Copyright © 2007 - ".$today["year"]; ?> </font> </center>
Advanced HTML Home
Copyright © 1997 - 2021
Hosted by 1&1