Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Application variables to pass colors

Status
Not open for further replies.

calista

Programmer
Jan 24, 2001
545
US
I am trying to set up application variables to pass colors to my various pages, but nothing I have tried seems to work correctly. I have tried using a single # in front of the hexidecimal color code, I have tried none and two. I either get an error, or the wrong color. BTW, if I display the value just before I call it in the body tag, it shows that the value is correct. If I just put the color code itself in, I get the right color. How do I handle this? Obviously, the point of all this is so I can change my color scheme by modifying one page. Thanks!
 
Hey Calista,

I would take a look at the html page returned and see how the resulting html syntax has been rendered. This should give you a clue as to where the problem is.

If you still have problems, just post your code for how you try to use the color in the body tag, the output if you just do a <cfouput>#application.color1#</cfoutput>, and then the actual rendered body tag if you do a view source. With this info, I or someone here should be able to point out the problem.

Good luck,
GJ
 
OK, here is the code where I set up the color in my Application.cfm page:

Code:
<cfset Application.LightBlue=&quot;##f0f8ff&quot;>

Now, here is the page where I try to use it:

Code:
<html>
<head>
	<title>Menu Page</title>
</head>
<cfoutput>Application.LightBlue = #Application.LightBlue#</cfoutput>
<body bgcolor=&quot;#Application.LightBlue#&quot;>
<br>

The <cfoutput> shows #f0f8ff. The color displayed is some kind of wierd dark rust color. (If you look at your palette, you will see that f0f8ff is a very pale blue.)

Hope this helps!
 
Try using Cascading Style Sheets. Then Reference Classes, instead of colors. It saves time once you have it set up. It also allows you to change all references to a class at once when you change that class. Combining variables in the code with style sheets is a very quick way to totally change your site appearance according to a user's selection.

Code:
Examples:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[i]In a separate file named [b]style.css[/b][/i]

.bodytitle
{	
	color: black;
	font-size : 110%;
	font-weight : bold;
	font-style : normal;
	text-decoration : none;
	font-family : Tahoma;
}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[i]In your application file named [b]application.cfm[/b][/i]

<cfset titletext=&quot;bodytitle&quot;>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[i]In your output file named [b]whatever.cfm[/b][/i]

<head>
<LINK rel=&quot;stylesheet&quot; href=&quot;style.css&quot;>
</head>

<body>
<cfoutput>
<font class=&quot;#titletext#&quot;>THE TITLE</font>
</cfoutput>
</body>



For More Help with Cascading Style Sheets try: 
[URL unfurl="true"]http://htmlgoodies.earthweb.com/beyond/css.html[/URL] 

Good Fortune,
Rick Walters aka LifeIsFun
 
Hey Calista,

This may be too simple but you don't seem to have cfoutput tags around the body statement. If this isn't it, the one piece I would still need to see is how the body tag reads in the actual returned page. You can get this by doing a &quot;view source&quot;. This will be what the browser actually received from the script.

GJ
 
GunJack, you were right. It's always the simple stuff that kills ya, isn't it?

LifeIsFun, I may give that a try. Thanks for the info.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top