| Author |
Topic Search Topic Options
|
Amateur
Senior Member
Joined: 22 July 2004
Location: Ireland
Status: Offline
Points: 210
|
Post Options
Thanks(0)
Quote Reply
Topic: Stylesheet via DB 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?
|
 |
Gullanian
Senior Member
Joined: 04 January 2002
Location: England
Status: Offline
Points: 4373
|
Post Options
Thanks(0)
Quote Reply
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.
|
 |
Amateur
Senior Member
Joined: 22 July 2004
Location: Ireland
Status: Offline
Points: 210
|
Post Options
Thanks(0)
Quote Reply
Posted: 06 December 2004 at 8:46am |
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?
|
 |
michael
Senior Member
Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
|
Post Options
Thanks(0)
Quote Reply
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.
|
|
|
 |
Bluefrog
Senior Member
Joined: 23 October 2002
Location: Korea, South
Status: Offline
Points: 1701
|
Post Options
Thanks(0)
Quote Reply
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).
|
|
|
 |
dpyers
Senior Member
Joined: 12 May 2003
Status: Offline
Points: 3937
|
Post Options
Thanks(0)
Quote Reply
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
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%>;} |
Edited by dpyers - 06 December 2004 at 9:18am
|
Lead me not into temptation... I know the short cut, follow me.
|
 |
Bluefrog
Senior Member
Joined: 23 October 2002
Location: Korea, South
Status: Offline
Points: 1701
|
Post Options
Thanks(0)
Quote Reply
Posted: 06 December 2004 at 9:40am |
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
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.
|
|
|
 |
Amateur
Senior Member
Joined: 22 July 2004
Location: Ireland
Status: Offline
Points: 210
|
Post Options
Thanks(0)
Quote Reply
Posted: 06 December 2004 at 10:26am |
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
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.
|
 |