[WSG] Dynamically populating stylesheets?
Hi guys, Is this even possible? What I have is a site that gives people a chance to set up their own information sections where they can record their own content. I would like that an account holder can state which colours, font sizes, font styles, etc they want for their section and have this information gets recorded in a database. That's the easy bit, and I can do that no problem. What I need then if that when a user navigates to a particular section, the system pulls these values from the database and populates the stylesheet with them so that the section displays in the requested colours and styles. If it makes any difference, I'm working in ColdFusion. Of course, if this is just a pipe dream then I'll just have to sit down and figure out another way around the problem. Id really prefer not to have to use the selection form as a way for account holders to email me their preferences so I can make them a new stylesheet if I can help it... :) Cheers, Seona. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.605 / Virus Database: 385 - Release Date: 1/03/2004 * The discussion list for http://webstandardsgroup.org/ *
Re: [WSG] Dynamically populating stylesheets?
You can do this with something like PHP, just a script that does something like this link rel=stylesheet type=text/css href=cssmaker.php / ?php header('Content-type: text/css'); echo 'H1 { font-family: Arial; } // etc! ? obviously, once you have something like that running, you can just change it so that the echo line pulls content from a database, then dumps it out, pretending to be a stylesheet :) HTH Beau -- Beau Lebens Information Architect [EMAIL PROTECTED] Dented Reality - www.dentedreality.com.au Information Architecture, Usability, Web Development Seona Bellamy said: Hi guys, Is this even possible? What I have is a site that gives people a chance to set up their own information sections where they can record their own content. I would like that an account holder can state which colours, font sizes, font styles, etc they want for their section and have this information gets recorded in a database. That's the easy bit, and I can do that no problem. What I need then if that when a user navigates to a particular section, the system pulls these values from the database and populates the stylesheet with them so that the section displays in the requested colours and styles. If it makes any difference, I'm working in ColdFusion. Of course, if this is just a pipe dream then I'll just have to sit down and figure out another way around the problem. Id really prefer not to have to use the selection form as a way for account holders to email me their preferences so I can make them a new stylesheet if I can help it... :) Cheers, Seona. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.605 / Virus Database: 385 - Release Date: 1/03/2004 * The discussion list for http://webstandardsgroup.org/ * * The discussion list for http://webstandardsgroup.org/ *
Re: [WSG] Dynamically populating stylesheets?
you could use inline styles to pull the required value(s) from the database. eg: (background-color: % your.recordset.value %;) dynamically generating a css documentfrom a dbase is beyond my feeble skills. Sennan LagalugaMock Orange Web Site DevelopmentU: www.mockorange.com.auP: 07 4953 4035F: 07 4953 40301st Floor, 92 Victoria StreetMackay Q Australia 4740 - Original Message - From: Seona Bellamy To: WSG List Sent: Wednesday, March 10, 2004 2:31 PM Subject: [WSG] Dynamically populating stylesheets? Hi guys,Is this even possible? What I have is a site that gives people a chance toset up their own information sections where they can record their owncontent. I would like that an account holder can state which colours, fontsizes, font styles, etc they want for their section and have thisinformation gets recorded in a database. That's the easy bit, and I can dothat no problem. What I need then if that when a user navigates to aparticular section, the system pulls these values from the database andpopulates the stylesheet with them so that the section displays in therequested colours and styles.If it makes any difference, I'm working in ColdFusion.Of course, if this is just a pipe dream then I'll just have to sit down andfigure out another way around the problem. Id really prefer not to have touse the selection form as a way for account holders to email me theirpreferences so I can make them a new stylesheet if I can help it... :)Cheers,Seona.---Outgoing mail is certified Virus Free.Checked by AVG anti-virus system (http://www.grisoft.com).Version: 6.0.605 / Virus Database: 385 - Release Date: 1/03/2004*The discussion list for http://webstandardsgroup.org/*
RE: [WSG] Dynamically populating stylesheets?
Just to make sure I understand you, Beau, the php code you show is the content of that cssmaker.php that you put in the href? Not sure if I can duplicate that with CF - it's that header bit that is the biggest problem I guess. Does anyone know if there's a similar function in CF? Thanks, Seona. -Original Message- From: Beau [mailto:[EMAIL PROTECTED] Sent: Wednesday, 10 March 2004 3:38 PM To: [EMAIL PROTECTED] Subject: Re: [WSG] Dynamically populating stylesheets? You can do this with something like PHP, just a script that does something like this link rel=stylesheet type=text/css href=cssmaker.php / ?php header('Content-type: text/css'); echo 'H1 { font-family: Arial; } // etc! ? obviously, once you have something like that running, you can just change it so that the echo line pulls content from a database, then dumps it out, pretending to be a stylesheet :) HTH Beau -- Beau Lebens Information Architect [EMAIL PROTECTED] Dented Reality - www.dentedreality.com.au Information Architecture, Usability, Web Development Seona Bellamy said: Hi guys, Is this even possible? What I have is a site that gives people a chance to set up their own information sections where they can record their own content. I would like that an account holder can state which colours, font sizes, font styles, etc they want for their section and have this information gets recorded in a database. That's the easy bit, and I can do that no problem. What I need then if that when a user navigates to a particular section, the system pulls these values from the database and populates the stylesheet with them so that the section displays in the requested colours and styles. If it makes any difference, I'm working in ColdFusion. Of course, if this is just a pipe dream then I'll just have to sit down and figure out another way around the problem. Id really prefer not to have to use the selection form as a way for account holders to email me their preferences so I can make them a new stylesheet if I can help it... :) Cheers, Seona. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.605 / Virus Database: 385 - Release Date: 1/03/2004 * The discussion list for http://webstandardsgroup.org/ * * The discussion list for http://webstandardsgroup.org/ * --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.605 / Virus Database: 385 - Release Date: 1/03/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.605 / Virus Database: 385 - Release Date: 1/03/2004 * The discussion list for http://webstandardsgroup.org/ *
Re: [WSG] Dynamically populating stylesheets?
Seona There are a number of ways to do this - the easiest way to do it is by populating some style tags dynamically from data in the db using a script language such as CF or PHP etc (although that can add pageweight). Another way would be to save a css file on the server for each person and serve that up (ouch.. disk space). Yet another (and the best) would be to send the User Agent a stylesheet, as discussed over at the Sydney PHP Group (apologies for the crap colours/layout - I'm working on it :D ). Managing multiple sites under a single codebase http://sydney.ug.php.net/phpBB2/viewtopic.php?t=70start=0postdays=0postorder=aschighlight= http://sydney.ug.php.net/phpBB2/viewtopic.php?t=70 I'd assume you are using CF under Windoze Server so I'm not sure if that has the flexibility an Apache config has? Cheers James Seona Bellamy wrote: Hi guys, Is this even possible? What I have is a site that gives people a chance to set up their own information sections where they can record their own content. I would like that an account holder can state which colours, font sizes, font styles, etc they want for their section and have this information gets recorded in a database. That's the easy bit, and I can do that no problem. What I need then if that when a user navigates to a particular section, the system pulls these values from the database and populates the stylesheet with them so that the section displays in the requested colours and styles. If it makes any difference, I'm working in ColdFusion. Of course, if this is just a pipe dream then I'll just have to sit down and figure out another way around the problem. Id really prefer not to have to use the selection form as a way for account holders to email me their preferences so I can make them a new stylesheet if I can help it... :) Cheers, Seona. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.605 / Virus Database: 385 - Release Date: 1/03/2004 * The discussion list for http://webstandardsgroup.org/ * * The discussion list for http://webstandardsgroup.org/ *
RE: [WSG] Dynamically populating stylesheets?
Hmm... that's a definite possibility. Might have to think a bit about that one. Thanks. :) If the "stylesheet" were to be included in the head of the document, rather than an external file, this should work Cheers, Seona. -Original Message-From: Sennan Lagaluga [mailto:[EMAIL PROTECTED]Sent: Wednesday, 10 March 2004 3:47 PMTo: [EMAIL PROTECTED]Subject: Re: [WSG] Dynamically populating stylesheets? you could use inline styles to pull the required value(s) from the database. eg: (background-color: % your.recordset.value %;) dynamically generating a css documentfrom a dbase is beyond my feeble skills. Sennan LagalugaMock Orange Web Site DevelopmentU: www.mockorange.com.auP: 07 4953 4035F: 07 4953 40301st Floor, 92 Victoria StreetMackay Q Australia 4740 - Original Message - From: Seona Bellamy To: WSG List Sent: Wednesday, March 10, 2004 2:31 PM Subject: [WSG] Dynamically populating stylesheets? Hi guys,Is this even possible? What I have is a site that gives people a chance toset up their own information sections where they can record their owncontent. I would like that an account holder can state which colours, fontsizes, font styles, etc they want for their section and have thisinformation gets recorded in a database. That's the easy bit, and I can dothat no problem. What I need then if that when a user navigates to aparticular section, the system pulls these values from the database andpopulates the stylesheet with them so that the section displays in therequested colours and styles.If it makes any difference, I'm working in ColdFusion.Of course, if this is just a pipe dream then I'll just have to sit down andfigure out another way around the problem. Id really prefer not to have touse the selection form as a way for account holders to email me theirpreferences so I can make them a new stylesheet if I can help it... :)Cheers,Seona.---Outgoing mail is certified Virus Free.Checked by AVG anti-virus system (http://www.grisoft.com).Version: 6.0.605 / Virus Database: 385 - Release Date: 1/03/2004*The discussion list for http://webstandardsgroup.org/*
RE: [WSG] Dynamically populating stylesheets?
Seona Bellamy wrote: Just to make sure I understand you, Beau, the php code you show is the content of that cssmaker.php that you put in the href? Not sure if I can duplicate that with CF - it's that header bit that is the biggest problem I guess. Does anyone know if there's a similar function in CF? Sure, use the cfheader tag: cfheader name=Content-type value=text/css/ Also, make sure you throw a cfsetting showdebugoutput=no/ so as not to include all the debugging info. -- Lindsay Evans. Developer, Red Square Productions. [p] 8596.4000 [f] 8596.4001 [w] www.redsquare.com.au * The discussion list for http://webstandardsgroup.org/ *
RE: [WSG] Dynamically populating stylesheets?
Yep Seona, that's it. You *might* get away without that header, but it's there to make it technically correct, and make sure that your browser doesn't freak out, because otherwise PHP will make the content appear (according to the header) as text/html format I think. Give it a go with CF if you like, just leave out the header and see what happens - just make sure you have the type=text/css in the LINK - that might be enough to force the content type. You'll want to check that in all browsers to make sure they all eat it tho :) Beau -- Beau Lebens Information Architect [EMAIL PROTECTED] Dented Reality - www.dentedreality.com.au Information Architecture, Usability, Web Development Seona Bellamy said: Just to make sure I understand you, Beau, the php code you show is the content of that cssmaker.php that you put in the href? Not sure if I can duplicate that with CF - it's that header bit that is the biggest problem I guess. Does anyone know if there's a similar function in CF? Thanks, Seona. -Original Message- From: Beau [mailto:[EMAIL PROTECTED] Sent: Wednesday, 10 March 2004 3:38 PM To: [EMAIL PROTECTED] Subject: Re: [WSG] Dynamically populating stylesheets? You can do this with something like PHP, just a script that does something like this link rel=stylesheet type=text/css href=cssmaker.php / ?php header('Content-type: text/css'); echo 'H1 { font-family: Arial; } // etc! ? obviously, once you have something like that running, you can just change it so that the echo line pulls content from a database, then dumps it out, pretending to be a stylesheet :) HTH Beau -- Beau Lebens Information Architect [EMAIL PROTECTED] Dented Reality - www.dentedreality.com.au Information Architecture, Usability, Web Development Seona Bellamy said: Hi guys, Is this even possible? What I have is a site that gives people a chance to set up their own information sections where they can record their own content. I would like that an account holder can state which colours, font sizes, font styles, etc they want for their section and have this information gets recorded in a database. That's the easy bit, and I can do that no problem. What I need then if that when a user navigates to a particular section, the system pulls these values from the database and populates the stylesheet with them so that the section displays in the requested colours and styles. If it makes any difference, I'm working in ColdFusion. Of course, if this is just a pipe dream then I'll just have to sit down and figure out another way around the problem. Id really prefer not to have to use the selection form as a way for account holders to email me their preferences so I can make them a new stylesheet if I can help it... :) Cheers, Seona. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.605 / Virus Database: 385 - Release Date: 1/03/2004 * The discussion list for http://webstandardsgroup.org/ * * The discussion list for http://webstandardsgroup.org/ * --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.605 / Virus Database: 385 - Release Date: 1/03/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.605 / Virus Database: 385 - Release Date: 1/03/2004 * The discussion list for http://webstandardsgroup.org/ * * The discussion list for http://webstandardsgroup.org/ *
RE: [WSG] Dynamically populating stylesheets?
Interesting article. :) Thanks. I might have to have a go at it later. And as far as I am aware (unless my hosting provider has changed servers and not told anyone) it is running on Apache. Cheers, Seona. -Original Message- From: James Ellis [mailto:[EMAIL PROTECTED] Sent: Wednesday, 10 March 2004 3:53 PM To: [EMAIL PROTECTED] Subject: Re: [WSG] Dynamically populating stylesheets? Seona There are a number of ways to do this - the easiest way to do it is by populating some style tags dynamically from data in the db using a script language such as CF or PHP etc (although that can add pageweight). Another way would be to save a css file on the server for each person and serve that up (ouch.. disk space). Yet another (and the best) would be to send the User Agent a stylesheet, as discussed over at the Sydney PHP Group (apologies for the crap colours/layout - I'm working on it :D ). Managing multiple sites under a single codebase http://sydney.ug.php.net/phpBB2/viewtopic.php?t=70start=0postdays=0posto rder=aschighlight= http://sydney.ug.php.net/phpBB2/viewtopic.php?t=70 I'd assume you are using CF under Windoze Server so I'm not sure if that has the flexibility an Apache config has? Cheers James Seona Bellamy wrote: Hi guys, Is this even possible? What I have is a site that gives people a chance to set up their own information sections where they can record their own content. I would like that an account holder can state which colours, font sizes, font styles, etc they want for their section and have this information gets recorded in a database. That's the easy bit, and I can do that no problem. What I need then if that when a user navigates to a particular section, the system pulls these values from the database and populates the stylesheet with them so that the section displays in the requested colours and styles. If it makes any difference, I'm working in ColdFusion. Of course, if this is just a pipe dream then I'll just have to sit down and figure out another way around the problem. Id really prefer not to have to use the selection form as a way for account holders to email me their preferences so I can make them a new stylesheet if I can help it... :) Cheers, Seona. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.605 / Virus Database: 385 - Release Date: 1/03/2004 * The discussion list for http://webstandardsgroup.org/ * * The discussion list for http://webstandardsgroup.org/ * --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.605 / Virus Database: 385 - Release Date: 1/03/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.605 / Virus Database: 385 - Release Date: 1/03/2004 * The discussion list for http://webstandardsgroup.org/ *
Re: [WSG] Dynamically populating stylesheets?
Seona You've got a few choices 1. As Beau mentions dynamically generate the style sheet. link rel=stylesheet type=text/css href=cssmaker.php / 2. Adjust inline style dynamically from the database 3. Have a collection of style sheets that are themes, Zen Garden style. eg. link rel=stylesheet type=text/css href=? echo $userStylesheet ?/ Not sure here, but method 1 might have caching issues, I've never tried this, so perhaps Beau can comment here. Inline styles are fine, only include the one you want members to modify. The theme style sheet method gives you less database content ( only the name of the style sheet ) and better control of what the site looks like, although this can limit the members choice of colours it does stop members from setting the text and background colours both to black. I've seen this sort of thing before and it goes something like this Why can't I see anything its all black? Regards Chris Blown http://hinterlands.com.au On Wed, 2004-03-10 at 15:38, Beau wrote: You can do this with something like PHP, just a script that does something like this link rel=stylesheet type=text/css href=cssmaker.php / ?php header('Content-type: text/css'); echo 'H1 { font-family: Arial; } // etc! ? obviously, once you have something like that running, you can just change it so that the echo line pulls content from a database, then dumps it out, pretending to be a stylesheet :) HTH Beau * The discussion list for http://webstandardsgroup.org/ *
Re: [WSG] Dynamically populating stylesheets?
Seona You could assignment the stylesheet from a cookie with php variables. Leo * The discussion list for http://webstandardsgroup.org/ *
Re: [WSG] Dynamically populating stylesheets?
Chris Blown said: 1. As Beau mentions dynamically generate the style sheet. link rel=stylesheet type=text/css href=cssmaker.php / Not sure here, but method 1 might have caching issues, I've never tried this, so perhaps Beau can comment here. you might run into some caching issues here, depending on the volume that you're dealing with. again, using headers, you could work around this. you can set a header with something like header('Content-expiry: date here'); or something like that (can't remember the exact header declaration off the top of my head) and just tell the UA to cache the output for a certain period of time, so that even tho you're repeatedly calling cssmaker.php, the browser should cache the output. another option would be temporary filesystem caching on the server, which can work quite well, where you write the css file once, then if it exists and is under a certain age, just give that to the user rather that hitting the database again. that can help on the server side a little :) Beau * The discussion list for http://webstandardsgroup.org/ *