Probably the simplest way is to just include a single file in all of your pages. Your web server might be set to parse .html files for PHP. You can check.
in a test.html file , enter
| Code: |
<?php
echo 'hello';
?>
|
If you see "hello" when viewing the web page, then .html will be fine, otherwise you'll need to use .php , or possibly .shtml .php is likely the best choice to ensure things you might add later will work.... Or, use a line in your .htaccess file to tell your web server to run .html files as PHP
Either way, includes are a god send.. If I need to create several static pages, where the info displayed is rarely changed I usually create a separate file for header, menu(s), and footer, then a blank template..., something like
| Code: |
<?php
include('./includes/header.php');
include('./includes/menu.php');
?>
<div id=MAINCONTENT>
MAIN CONTENT GOES HERE
</div>
<?php
include('./includes/footer.php');
?>
|
Anytime I need a new page, I just take a copy of my blank template, rename the file, such as about_us.php and fill in the main content area.
Anytime I want to make a site wide edit to the header, for example I just need to edit one file, ./includes/header.php in this case.
If you wanted to get fancy, you could make your menu.php file do database lookups, or possibly read in a file that is updated nightly via cron.
Finally, I occasionally need to remind myself, and post here for posterity.. I am here to help people customize and/or troubleshoot the script I offer here. I also try to help people like yourself with general web programming and related stuff, but, I do have to draw a line somewhere regarding what I will provide for free. I am a human after all and among other things, I need to eat.
If you prefer to figure this out, then I will certainly be here to help decipher error messages and try to point you in the right direction, but I can't write it for you unless of course you hire me to do so.
Either way, you are the ambitious type and I like that, so tip #1 if you use Windows, grab the PHP help files in CHM format.. yet another god send
http://www.php.net/download-docs.php