i'm making a website for someone. the website has a drop down navigation menu common to all pages, as well as a left column and right column common to all the pages. the site is getting large, and i know it will only continue to grow.
as of now, the site is done completely in html and css (with a little javascript...). however, there are over 50 different pages, and this number will only continue to go up.
i decided to go ahead and use a little bit of php--put the html code that is common to all pages in a single php file, which i will include in all pages. i will then replace all the common code with simple function calls. this way i can update the entire site very quickly by just editing the php file.
here's my problem. i started to do this today, but ran into some strange errors. while everything looked perfectly normal in firefox, for some reason, the page layout was completely messed up in IE (tested in v. 6 and 7). for example, the drop down navigation menu turned up in the middle of the page instead of the top!
a very simple example of what i did:
original file:
<html>
<head>
stylesheet references...
</head>
<body>
<div id="header">
<div id="menu">
SOME_MENU_CODE
</div>
</div>
</body>
</html>
made a file "nav_menu.php"
<?PHP
function showNav() {
echo("SOME_MENU_CODE");
}
?>
then the index page:
<?PHP include 'nav_menu.php'; ?>
<html>
<head>
stylesheet references...
</head>
<body>
<div id="header">
<div id="menu">
<?PHP showNav(); ?>
</div>
</div>
</body>
</html>
like i said, this works perfectly in firefox, but it dies in IE6 and 7. i have a feeling it's either something very simple i'm overlooking. if you can't think of what is causing this, and you know a better way to update all the pages on a site by editing one file which the other pages reference...please let me know...i'm going crazy here...
thank you!
Tags: