Solved

Including CSS files from outside the wwwroot in Coldfusion

Posted on 2013-01-23
8
455 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
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Today, I was working on some optimization and spam-stopping techniques when I encountered Ben Nadel's post to reduce spam feature using Math (http://www.bennadel.com/blog/197-How-I-Stop-Spammers-On-My-ColdFusion-Blog.htm). While this method is not o…
This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

761 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