Sorry Gary but for some reason it does not keep its formatting..

I tried your way but not only the images but also the colours get lost..

So what I had to do was add <style></style> to the top and bottom with cfoutput and I already ##'d everything and did a CFInclude in the head of document, and this now works..

You would think that your method works (I did try that before) as I saw the idea on
http://www.adobe.com/macromedia/events/max/sessions/sa302w.html
(about 3/4 of the way down)

but this has only got a cfif url eq statement and not an cfoutput...

I am testing it with the aura design from Leorex (leorex.com) so it has another couple of css sheets with it.(maybe that makes it go all funny?

So if I am still missing something please let me know..or if someone has done this before by doing a
<link type=text/css href="">
Thanks


On 5/27/06, Gary Menzel <[EMAIL PROTECTED]> wrote:
 
The easiest way to create dynamic CSS using Coldfusion is to simply just point the <link> tag at a CFM file.
 
You dont need to worry about content type as text is text.
 
<link rel="stylesheet" href="">
 
Then - as Darryl has already pointed out - if you want to have CF inside the CFM file, you need to wrap the text in a <CFOUTPUT>.  IF the file just has text and no CF then you dont need the <CFOUTPUT> (but then the question would be - "Why do it at all?" - because if it is just plain text you would just use a normal CSS file).
 
BUT....... because CFM usese # to delimit variable names, you need 2 hashes to get one hash AND you still need to wrap your CFM variables.  So - count those #'s.  The first two hashes (##) will translate to ONE hash when CF has finished with it.  Then, the next hash indicates the start of a variable.  Then there is the variable name, followed by the terminating hash.  The 'color' attribute also requires a double hash in CF to get a single.
 
There is only one other question I would have (or comment to make) and that is you would need to ensure that your REQUEST scope was initialised in your Application.cfm - unless you are including other code at the top to set the REQUEST scope.
 
e.g.
 
<cfoutput>

      body {
              background-color:###request.bodyBackgroundColour#;
              color:##222;
              }
</cfoutput>
 
--OR-- you COULD do this.....
 
      body {
              background-color:#<CFOUTPUT>#request.bodyBackgroundColour#</CFOUTPUT>;
              color:#222;
              }
 
 
But - if you are going to have a heavily dynamic file, wrapping the whole thing in one <CFOUTPUT> is probably going to be easier to maintain - just remember DOUBLE HASH = HASH.
 
Regards
Gary

 
On 5/26/06, Carlos-Amigos < [EMAIL PROTECTED]> wrote:

Hello CF Aussie,

I am having some troubles with some dynamic css if someone can help, I
want the colours to come from the database and not do a (if
url.template eq) scenario, as I am thinking about having about 20 or 30
templates with all different colours..

I have tried putting <cfoutput> in the aura_screen_design.cfm (css) but
throws everything out

index.cfm
====
<!--- Dynamic cfm posed as a CSS sheet --->
<style type="text/css" media="screen">@import
"r/s/aura_screen_design.cfm";</style>

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


blah blah
====

aura_screen_design.cfm
====
<cfcontent type="text/css; charset=utf-8">
      body {
              background-color:##request.bodyBackgroundColour#;
              color:#222;
              }
====

Thanks

Carl









--
====================================
Postal: Po Box 3462 Dural, NSW 2158
Email: mailto:[EMAIL PROTECTED]
FireFly Internet Phone: 80011777
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cfaussie
-~----------~----~----~----~------~----~------~--~---

Reply via email to