Dynamic CSS with ColdFusion
ColdFusion
Quick little shout-out here...simple and cool way to have dynamic stylesheets.
We are developing an application that will be used by many different companies, each with their own set of colors and styles.
Basically there is a Company object, which has a handle on its own set of Style attributes.
In the link to the style sheet, I just changed the extension to .cfm (instead of .css)...
<link rel="stylesheet" href="/themes/style.cfm" type="text/css" media="screen" />
And then in the style.cfm sheet, just add a cfcontent tag...
<cfcontent type="text/css" >
Then go on about your cfoutputting...
body{
background-color: <cfoutput>#Style.getBodyColor()#</cfoutput>;
color: <cfoutput>#Style.getDefaultFontColor()#</cfoutput>;
font-size: <cfoutput>#Style.getDefaultFontSize()#</cfoutput>;
font-family: <cfoutput>#Style.getDefaultFontFamily()#</cfoutput>;
text-align: center;
}
We are developing an application that will be used by many different companies, each with their own set of colors and styles.
Basically there is a Company object, which has a handle on its own set of Style attributes.
In the link to the style sheet, I just changed the extension to .cfm (instead of .css)...
<link rel="stylesheet" href="/themes/style.cfm" type="text/css" media="screen" />
And then in the style.cfm sheet, just add a cfcontent tag...
<cfcontent type="text/css" >
Then go on about your cfoutputting...
body{
background-color: <cfoutput>#Style.getBodyColor()#</cfoutput>;
color: <cfoutput>#Style.getDefaultFontColor()#</cfoutput>;
font-size: <cfoutput>#Style.getDefaultFontSize()#</cfoutput>;
font-family: <cfoutput>#Style.getDefaultFontFamily()#</cfoutput>;
text-align: center;
}





Loading....