I've created two functions which I include in all my pages. The Header function echos the first portion of my html (including tags: html, head, body, container div, logo img, etc.) and the Footer function closes the open tags. The problem I've run into is that the head tag has relative links to the CSS and JS files, so when I create a page which is in a subdirectory and use the same functions, it obviously cannot locate the CSS or JS.
The reason I don't wish to use absolute linkage is the fact that I'm developing with WAMP on my workstation and the paths vary from when I'm testing it locally and when it is on the web server.
So how do I make the same function work for a page regardless of its directory location without using absolute linkage? Is there some sort of argument I can pass to the function to remedy this?
Many thanks!
Code: Select all
function insertHeader() {
echo '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Executive Search Firm for the Kitchen/Bath and Building Industry | Brooke Chase Associates, Inc.</title>
<meta name="Copyright" content="All Images, Flash, Copy and Code copyright 2008 Brooke Chase Associates, Inc." />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<!-- css -->
<link href="css/display.css" rel="stylesheet" type="text/css" />
<!-- jquery -->
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/jquery.validate.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#form").validate();
});
</script>
</head>
<body>
<div id="container">
';
}