[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Including CSS files from outside the wwwroot in Coldfusion

Posted on 2013-01-23
8
Medium Priority
?
473 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 2000 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
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.

 
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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

649 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