set an application variable that stores the absolute URI to the root of your site. If you're hosted on a domain name, it'll be "/". if you're in the 'myapp' directory, it'll be "/myapp/". Make sure that the first and last character are both '/', or it won't work right. You'll have to ensure that you set the variable to the appropriate value if you change the configuration of the server. Then use that variable in all your references to external resources:
<link rel="stylesheet" type="text/css" href="#application.uri_root#css/main.css" /> <img src="#application.uri_root#images/myImage.gif" /> If you don't want to have to remember to set that variable when you move you application, you can write some code that uses the cgi.script_name variable to compute the proper value for you, but doing it is potentially tricky, depending on how your application templates are layed out across directories. HTH, barneyb --- Barney Boisvert, Senior Development Engineer AudienceCentral [EMAIL PROTECTED] voice : 360.756.8080 x12 fax : 360.647.5351 www.audiencecentral.com > -----Original Message----- > From: Jim McAtee [mailto:[EMAIL PROTECTED] > Sent: Wednesday, July 16, 2003 5:24 PM > To: CF-Talk > Subject: Using relative links in a common header > > > I've got a small app with a directory structure something like > the following: > > / > /catalog > /css > /maint > /products > /orders > /images > /includes > > Within /includes I have common header and footer files, with the header > containing (simplified): > > <html> > <head> > <title>Application_Name</title> > </head> > <body bgcolor="white" text="black"> > > and this is just included in the template using > > <cfinclude template="include/header.cfm"> or > <cfinclude template="../include/header.cfm"> or > <cfinclude template="../../include/header.cfm"> > > depending on where in the directory tree the template resides. I > want to place > a relative reference in this header to a style sheet contained in the /css > directory. > > <html> > <head> > <title>Application Name</title> > <link rel="stylesheet" type="text/css" href="css/main.css"> > </head> > <body bgcolor="white" text="black"> > > How do I construct the href in the <link> tag to work > independently of where > the template is within the directory tree? I want to be able to take this > whole app and to be able to place it anwhere in an existing web > directory tree > without modification, so I can't use absolute referencing to the > style sheet, > unless the link were dynamically generated by CF. > > Thanks, > Jim > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

