link to css and javscript
Hi,
I have my main folder with all my cfm files it also contains a folde called template with the header and footer for all the pages.
In every page I add the header
<cfinclude template="templates/header.cfm" />
and this contains relative links to my css and jquery
<link rel="stylesheet" type="text/css" href="../css/main.css" />
<link rel="stylesheet" type="text/css" href="../css/font.css" />
<link rel="stylesheet" type="text/css" href="../css/forms.css" />
<script type="text/javascript" src="../scripts/jquery.js"></script>
<script src="../scripts/jquery.validate.js" type="text/javascript"></script>
The problem is I now have to have a subfolder with a few files in it. So my link changes to
<cfinclude template="../templates/header.cfm" />
and then the css and js is not included. I can get it working with absolute links (feels wrong to me) but i would like an elegant solution to get this working without duplicating the header.
Coldfusion or non serverside solutions much appreciated.
By the way...I thought you could just put a leading / to get the site root
<link rel="stylesheet" type="text/css" href="/css/main.css" />
<link rel="stylesheet" type="text/css" href="/css/font.css" />
<link rel="stylesheet" type="text/css" href="/css/forms.css" />
<script type="text/javascript" src="/scripts/jquery.js"></script>
<script src="/scripts/jquery.validate.js" type="text/javascript"></script>
but this does not seem to work either.