Solved

Including CSS files from outside the wwwroot in Coldfusion

Posted on 2013-01-23
8
460 Views
Last Modified: 2013-01-23
I have looked all over the internet for this answer and can not find one solution that works with CSS file. I am trying to include css files from outside the wwwroot folder. How can I do this? I am hosting my site on Hostek Coldfusion servers.
0
Comment
Question by:Envisoin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 15

Expert Comment

by:Tomarse111
ID: 38810923
If its a windows box with IIS, you can create a virtual directory to where the external CSS files live. Then just reference them from there in the normal way.

http://www.iis.net/configreference/system.applicationhost/sites/site/application/virtualdirectory

Tom
0
 

Author Comment

by:Envisoin
ID: 38810954
Unfortunately I do not have access to the admin can create a virtual directory. Is there any way to do that programmatically using ColdFusion? I know you can do with images, but is impossible to include a CSS file from outside the web root and having work?
0
 
LVL 36

Accepted Solution

by:
SidFishes earned 500 total points
ID: 38811005
YOu can use cffile and then just write the variable within a style tag.

<cfoutput>
	<cffile action="read" file="c:\temp\test.css" variable="css">
<style>
#css#
</style>
<div>This is unstyled/</div>
<div id="test">this is styled</div></cfoutput>

Open in new window

0
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 
LVL 15

Expert Comment

by:Tomarse111
ID: 38811008
You may be able to do it through the CF admin in Mappings but im pretty certain they are only accesible through certain CF tags .. like cfinclude. I dont think a <link> would work on it, so:

<link type="text/css" media="screen" rel="stylesheet" href="/folderdoutside/test.css" />

Would not work.

Why would you not put the CSS in your webroot? You could host it on another URL and reference that?
0
 
LVL 36

Expert Comment

by:SidFishes
ID: 38811020
(I've shown you how to do what you want but I'd have to agree with Tomarse, why not put it in the webroot....?)
0
 

Author Comment

by:Envisoin
ID: 38811074
The reason I don't want to put in in the web root is because of an ex-friend of mine who was directly stealing my work. For the last 10 years I've been telling him to get on the CSS bandwagon and he has fought me over making the transition. He still doesn't all of these websites with in-line CSS. He recently was asked to make changes to one of his websites that had over 3200 pages of in-line CSS code and he asked me for help. He said he would pay me $500 out of the $2500 he was getting paid to redesign the site. He never paid me and every time I publish a new website he's been stealing my CSS code. Normally I would not care, but he is direct competition for me and my web design business and after what he did I will not help him!
0
 
LVL 36

Expert Comment

by:SidFishes
ID: 38811104
well, unfortunately, you won't be able to prevent them from stealing css - it will -always- be visible, just as js has to be. If it's not, the browser can't use it. This is by design.

 Any tool like firebug will be able to inspect every css file.

Putting a copyright notice in your css files and then threatening with legal action is about all you can do
0
 

Author Closing Comment

by:Envisoin
ID: 38811128
Thank you for the rapid response to this question!!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question