Store this block in the database…

div.template1

{
width: [**divtemplateWidth**];
height: [**divtemplateHeight**];
border: 1px solid black;
background-color : [**divTempalteBgColor**];

}



Also store your divTemplateBGColor, divTemplateWidth, divTemplateHeight in
the database

Query for your style blocks

Then query for all of your values

Now replace the key strings in the Style block with the values

<cfset StyleBlockFinal = BlockQuery.StyleBlock>

<cfset StyleBlockFinal = Replace(StyleBlockFinal, “[**divTemplateWidth**]”,
ValueQuery.divTemplateWidth, “ALL”)>

<cfset StyleBlockFinal = Replace(StyleBlockFinal, “[**divTemplateHeight**]”,
ValueQuery.divTemplateHeight, “ALL”)>

<cfset StyleBlockFinal = Replace(StyleBlockFinal,
“[**divTemplateBgColor**]”, ValueQuery.divTemplateBgColor, “ALL”)>

<style type="text/css">
#SyleBlockFinal#

</style>



I haven’t used this but I’ve been kicking around the idea for a skinned
message board I have.

Right now Im just storing the directory names in the database

Each directory has a style.css in it. The style being used for the skin
depends on an ACTIVE status in the database

Each of the directories also has an “images” directory with the buttons for
that skin.

I’d like to hear other’s thoughts on dynamic skins and styles myself. In my
case, the above example (style code in the database) could get rather large
and probably way too much overhead for a skin feature.



   _____  

From: Shawn McKee [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 14, 2004 10: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

   _____  

[HYPERLINK "http://www.houseoffusion.com/lists.cfm/link=t:4"Todays Threads]
[HYPERLINK "http://www.houseoffusion.com/lists.cfm/link=i:4:178273"This
Message] [HYPERLINK
"http://www.houseoffusion.com/lists.cfm/link=s:4"Subscription] [HYPERLINK
"http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=678.598.4"Fast
Unsubscribe] [HYPERLINK "http://www.houseoffusion.com/signin/"User Settings]
[HYPERLINK
"https://www.paypal.com/cgi-bin/webscr?amount=&item_name=House+of+Fusion&bus
iness=donations%40houseoffusion.com&undefined_quantity=&cmd=_xclick"Donation
s and Support]

   _____  

HYPERLINK "http://www.houseoffusion.com/banners/view.cfm?bannerid=34" \n

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.759 / Virus Database: 508 - Release Date: 9/9/2004

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.759 / Virus Database: 508 - Release Date: 9/9/2004
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to