<cfset fred = queryNew("text")>
<cfset queryAddRow(fred, 1)>
<cfset x = QuerySetCell(fred, "text", "####template1Text{float: right;width:
135px;font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;font-size:
10px;text-align: left;padding: 5 5 5 5;color : #variables.txtcolor##")>

<cfquery name="chris" dbtype="query">
   SELECT * FROM FRED
</cfquery>


<cfset variables.txtcolor = "blue">


<cfoutput>#Evaluate(DE(chris.text))#</cfoutput>

-----Original Message-----
From: Shawn McKee [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 14, 2004 9:19 AM
To: CF-Talk
Subject: Variable names stored in database

I would like to store style sheet information in a database but need to be
able to change some of the parameters on the fly.  If a straight file doing
the variable substitutions is no big deal.

<cfquery name="specs" datasource="#dsn#">
   SELECT
      color
   FROM
      spec_table
   WHERE
      customer = 42
</cfquery>

<cfset variables.bgcolor = spec.color>

<cfoutput>
   <style type="text/css">
      div.template1{
       width: 300;
       height: 250;
       border: 1px solid black;
       background-color : #variables.bgcolor#;
      }
   </style>
</cfoutput>

Yes I know I don't need to use the extra step in this case but if it is
stored in a DB I need constant names in string.

So is it possible to store the style block in  a DB and then do the variable
replacement?

Shawn McKee
Mgr., Web Development
http://www.newsstand.com
  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to