[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 269
  • Last Modified:

Include dynamic style sheet

I would like to link to a dynamic style sheet created in CF (<link href="CSS.cfm" rel="stylesheet" type="text/css">) (it is being linked on a CF page). I've added <cfcontent type="text/css; charset=ISO-8859-1"> to the css.cfm and the page displays correctly in in IE and Mozilla, but the stylesheet isn't applied in Netscape or Opera?

::Stylesheet::
  <cfcontent type="text/css; charset=ISO-8859-1">
 <cfquery name="userSettings" datasource="barney">
     SELECT * FROM userSettings WHERE user=#authenicatedUserID#
 </cfquery>
<style type="text/css">
   <!--
     .NormalText {  font-family: <cfoutput>#userSettings.normalFont#</cfoutput>;}
    -->
</style>

I can make it work in all browsers, by using a cfinclude, but I would prefer to link to the dynamically generated CSS.

How can I get this to work w/ Netscape & Opera (while still working in IE & Mozilla) using the link implementation?
0
LERNWebmaster
Asked:
LERNWebmaster
3 Solutions
 
jake3362Commented:
This is probably just one of a hundred different ways of doing this.  Off the top of my head right now I think you could generate .css page everytime a user logs in, and populate it with info from your userSettings table.  You could name them #Client.CFID#_#Client.CFToken#.css, and then use this to link them in:

<cfoutput>
<link href="PATH_TO_CSSFILES/#Client.CFID#_#Client.CFToken#.css" rel="stylesheet" type="text/css" />
</cfoutput>

Client.CFID and Client.CFToken are used with session variables.

0
 
LERNWebmasterAuthor Commented:
Thank you for the suggestion, I would rather not write CSS files for each user each time, as over time I'm going to have a lot of CSS files to clean out and the constant disk writes would affect performance.  Any others?  I was thinking that I'm just not setting the content type correctly.
0
 
kkhippleCommented:
Check out Eric Meye on CSS http://www.ericmeyeroncss.com/bonus/trick-hide.html
Maybe that'll get you directed in the right path. But I believe this question is best suited for the CSS ppl.

good luck

KDK
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Jerry_PangCommented:
<cfquery name="userSettings" datasource="barney">
     SELECT * FROM userSettings WHERE user=#authenicatedUserID#
 </cfquery>

should that be
<cfquery name="userSettings" datasource="barney">
     SELECT * FROM userSettings WHERE user='#authenicatedUserID#'
 </cfquery>

???
0
 
LERNWebmasterAuthor Commented:
using the single quotes isn't necessary, as the data type for user is int.
0
 
kkhippleCommented:
thank you for accepting my answer LERNWebmaster  .. however, if my answer was the accepted answer.. why the low C grade?
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now