I using 5 different colors for highlight with the goal of having a different color on each page request. Sounds silly but works in the context of what I am doing.
So I have five images with the color as a tint. I am also trying to fade in the image from its plain color to the tinted one. I have most of it working but have run into an issue. I am using the tutorial here: http://clagnut.com/sandbox/imagefades/ I originally had this at the top of text.cfm, my dynamic style sheet. <cfsilent> <cfset randomnumber = randrange(1,5)> <cfset variables.colorlist = "35536b,3b5629,75405a,554373,6e4434"> <cfset request.randomcolor = listgetat(variables.colorlist, randomnumber)> </cfsilent> <cfcontent type="text/css" /> <cfoutput> .logo { color: ##dddddd; font-weight: bold; font-size: 25px; font-family: Arial Black, Verdana, Arial, Helvetica, sans-serif; line-height: normal; margin-top: 200px; margin-bottom: 100px; line-height:200%; } ##photoholder { width:700px; height:299px; background: url('/includes/www_mysite_com/prod/images/5f4b2a.jpg') no-repeat; } ##thephoto { width:700px; height:299px; src: url("/includes/www_mysite_com/prod/images/</cfoutput><cfoutput>#variables.randomcolor#</cfoutput><cfoutput>.jpg"); } .enhanced { color: ##</cfoutput><cfoutput>#variables.randomcolor#</cfoutput><cfoutput>; } </cfoutput> Have the extraneous cfoutputs because I was having trouble escaping properly. Anyways, I needed the same value in the calling page that generates the html, so I moved the random part to application.cfm: <cfset randomnumber = randrange(1,5)> <cfset variables.colorlist = "35536b,3b5629,75405a,554373,6e4434"> <cfset request.randomcolor = listgetat(variables.colorlist, randomnumber)> And then referenced it in the style sheet as request.randomcolor instead of variables.random color. The problem is, because I am referencing text.cfm like so, it is seen as two separate requests by the server and thus I get two different random numbers. <link rel="stylesheet" href="/includes/www_mysite_com/prod//layoutfiles/text.cfm" type="text/css"> So instead I tried passing the random number as a url variable, but no dice. <link rel="stylesheet" href="/includes/www_mysite_com/prod//layoutfiles/text.cfm?rc=#request.randomcolor#" type="text/css"> And then in text.cfm reference it like so: <cfset variables.randomcolor = val(trim(url.rc))> But it does not work. What is the best way to do this? I hope this makes sense, I know it sounds kind of convoluted. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-community/message.cfm/messageid:313364 Subscription: http://www.houseoffusion.com/groups/cf-community/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-community/unsubscribe.cfm
