Print Page | Close Window

Stylesheet via DB

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: General Discussion
Forum Description: General discussion and chat on any topic.
URL: https://forums.webwiz.net/forum_posts.asp?TID=12850
Printed Date: 01 April 2026 at 5:14pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Stylesheet via DB
Posted By: Amateur
Subject: Stylesheet via DB
Date Posted: 06 December 2004 at 5:37am
Could anyone enlighten me how I could set up a cascading stylesheet to read its values (text size etc) from an Access Database?



Replies:
Posted By: Gullanian
Date Posted: 06 December 2004 at 8:19am
If you have the CSS file internal to a page, then you can replace the values with <%=var%> tags after the database call.

If you use external stylesheets, you need to configure the webserver to execute ASP on .css file extensions.


Posted By: Amateur
Date Posted: 06 December 2004 at 8:46am
Originally posted by Gullanian Gullanian wrote:


If you use external stylesheets, you need to configure the webserver to execute ASP on .css file extensions.
 
It will be an external stylesheet. How do I configure the webserver to execute ASP/ASP.NET on .css file extensions?


Posted By: michael
Date Posted: 06 December 2004 at 8:53am
I would not do that, just create a standard asp/aspx file, read your values from the db and change the response output type to text/css, thus if you are using .net this is not really necessary as it just creates additional overhead.

-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: Bluefrog
Date Posted: 06 December 2004 at 8:54am
I put a long post on this somewhere in the forums a long time ago - try a search. You simply need to go into IIS and configure it to accept files with a CSS extension to be processed through the asp.dll under the WINDOWS directory (look in a sub dir). Make sure to configure the verbs the same as ASP (ASP.NET).



-------------
http://renegademinds.com/" rel="nofollow - Renegade Minds - Guitar Software http://renegademinds.com/Default.aspx?tabid=65" rel="nofollow - Slow Down Music


Posted By: dpyers
Date Posted: 06 December 2004 at 9:17am
Actually, a style sheet does not have to end in css. I use asp style sheets all the time, Check out http://www.new2asp.com/Template.asp - http://www.new2asp.com/Template.asp
 
If you View Source, you'll see the style sheet invoked with
<link rel="stylesheet" type="text/css" href="/css/new2asp_css.asp?TestFlag=y">
 
There a link in the top-right box to view the asp style sheet used.
Note that the .asp stylesheet begins with
<%Response.ContentType="text/css"%>
 
For the rest of it, it's just like then you intermingle asp and html code.
In this example, I use code at the bottom of the style sheet to put in code to override styles for testing purposes. Could just as easily had something like this within the css code
h1 { font-size:<%=somevariable%>;font-family:<%some asp code%>;}


-------------

Lead me not into temptation... I know the short cut, follow me.


Posted By: Bluefrog
Date Posted: 06 December 2004 at 9:40am
Originally posted by dpyers dpyers wrote:

Actually, a style sheet does not have to end in css. I use asp style sheets all the time, Check out http://www.new2asp.com/Template.asp%20 - http://www.new2asp.com/Template.asp
 
If you View Source, you'll see the style sheet invoked with
<link rel="stylesheet" type="text/css"
href="/css/new2asp_css.asp?TestFlag=y">
 
There a link in the top-right box to view the asp style sheet used.
Note that the .asp stylesheet begins with
<%Response.ContentType="text/css"%>
 
For the rest of it, it's just like then you intermingle asp and html code.
In this example, I use code at the bottom of the style sheet to put in code to override styles for testing purposes. Could just as easily had something like this within the css code
h1 { font-size:<%=somevariable%>;font-family:<%some asp code%>;}


Very true, and a much more versatile solution, as well as being cheaper on the CPU.




-------------
http://renegademinds.com/" rel="nofollow - Renegade Minds - Guitar Software http://renegademinds.com/Default.aspx?tabid=65" rel="nofollow - Slow Down Music


Posted By: Amateur
Date Posted: 06 December 2004 at 10:26am
Originally posted by dpyers dpyers wrote:

Actually, a style sheet does not have to end in css. I use asp style sheets all the time, Check out http://www.new2asp.com/Template.asp - http://www.new2asp.com/Template.asp
 
If you View Source, you'll see the style sheet invoked with
<link rel="stylesheet" type="text/css" href="/css/new2asp_css.asp?TestFlag=y">
 
There a link in the top-right box to view the asp style sheet used.
Note that the .asp stylesheet begins with
<%Response.ContentType="text/css"%>
 
For the rest of it, it's just like then you intermingle asp and html code.
In this example, I use code at the bottom of the style sheet to put in code to override styles for testing purposes. Could just as easily had something like this within the css code
h1 { font-size:<%=somevariable%>;font-family:<%some asp code%>;}
 
Thanks for this, really helps me. Going to play around with this for a while and see what i can do with it in ASP.NET. Presume that I can connect to a db in the new2asp_css.asp so will go from there.


Posted By: dpyers
Date Posted: 06 December 2004 at 11:02am
I've used the same technique with .net.
You can put any code you want into the css but remember that it will be cached on the users machine. so if you need to use different css for each session, add a session id to a query string parameter in the css file name.


-------------

Lead me not into temptation... I know the short cut, follow me.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net