Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can CF be forced to parse files without a .cfm extension? 1

Status
Not open for further replies.

gtbikerider

Technical User
May 22, 2001
81
GB
I need to use variables inside a CSS file. How can I make ColdFusion parse the .css file. Alternativly, is there a way I can rename the .css to .cfm?

--
John
 
In your HTML, where you would normaly link to file.css, just link to file.cfm instead. The browser doesn't care what extension your CSS file has, it will work regardless.

Hope this helps

Wullie

Fresh Look - Quality Coldfusion 7/Windows Hosting
YetiHost - Coming Soon

The pessimist complains about the wind. The optimist expects it to change. The leader adjusts the sails. - John Maxwell
 
what about browser caching? doesn't the browser issue that whatchmacallit http request, "give me the file only if it has changed since datestamp"? how would you be able to get the coldfusion css template to do that?

r937.com | rudy.ca
 
If caching is an issue, then you just fool the browser into forcing a reload for every request by appending a random query string.

Code:
<link rel="stylesheet" href="/file.cfm?<cfoutput>#RandRange(1, 9999999)#</cfoutput>" type="text/css" />

If you are already passing a query string, you can just add a fake variable onto the end of it as follows:

Code:
<link rel="stylesheet" href="/file.cfm?var1=value1&var2=value2&fakestring=<cfoutput>#RandRange(1, 9999999)#</cfoutput>" type="text/css" />

Hope this helps

Wullie

Fresh Look - Quality Coldfusion 7/Windows Hosting
YetiHost - Coming Soon

The pessimist complains about the wind. The optimist expects it to change. The leader adjusts the sails. - John Maxwell
 
you do not want a different css file on every page, right?

That depends on what influences the variables that are in the file. If you have something in the file that needs to be read/could change on every page request, then you couldn't have it cached.

If you want to make sure it is cached, then you could use cfcache and then a local copy of the output is stored on the server and client's machine:


Hope this helps

Wullie

Fresh Look - Quality Coldfusion 7/Windows Hosting
YetiHost - Coming Soon

The pessimist complains about the wind. The optimist expects it to change. The leader adjusts the sails. - John Maxwell
 
Rudy,

The following shows an example of using the If-Modified-Since header:


Because the CSS file is parsed for CF, you could get away with using this without a problem.

Hope this helps

Wullie

Fresh Look - Quality Coldfusion 7/Windows Hosting
YetiHost - Coming Soon

The pessimist complains about the wind. The optimist expects it to change. The leader adjusts the sails. - John Maxwell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top