473,466 Members | 1,462 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Include or link to Stylesheet

Hi - in my current pages, I have:

<link href="styles.css" rel="stylesheet" type="text/css">

What I would like to do is:
<!--#include file="config.asp" -->
<!--#include file="styles.asp" -->

config.asp read values from a database, which are used to populate
colours within the styles.asp sheet - for example, styles.asp looks
like:

<style type="text/css">
<!--
a, a:visited { color: <%=acolour%> }
a:hover { colour: <%=ahovcolour%> }
body, td, p {font-size: <%=fontsize%>; color: <%=fontcol%> }
-->
</style>

So, depending on user settings, values read from config.asp will be used
to populate the style sheet which is included in-line, and not
referenced by a link.

Is this a practical way of achieveing different user specific settings
for the same pages?

Is there a reason one way or the other why I shouldn't do it this way?
Is there a better way of giving people a way to customize colours and
other styles for their account?

Thanks for any help.

Mark





*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #1
6 1925
There's a third option you didn't mention.

<link rel=stylesheet href=styles.asp?userid=whatever></link>

Where styles.asp goes to the database and returns a style sheet...

--
http://www.aspfaq.com/
(Reverse address to reply.)


"Mark" <an*******@devdex.com> wrote in message
news:ev**************@TK2MSFTNGP11.phx.gbl...
Hi - in my current pages, I have:

<link href="styles.css" rel="stylesheet" type="text/css">

What I would like to do is:
<!--#include file="config.asp" -->
<!--#include file="styles.asp" -->

config.asp read values from a database, which are used to populate
colours within the styles.asp sheet - for example, styles.asp looks
like:

<style type="text/css">
<!--
a, a:visited { color: <%=acolour%> }
a:hover { colour: <%=ahovcolour%> }
body, td, p {font-size: <%=fontsize%>; color: <%=fontcol%> }
-->
</style>

So, depending on user settings, values read from config.asp will be used
to populate the style sheet which is included in-line, and not
referenced by a link.

Is this a practical way of achieveing different user specific settings
for the same pages?

Is there a reason one way or the other why I shouldn't do it this way?
Is there a better way of giving people a way to customize colours and
other styles for their account?

Thanks for any help.

Mark





*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #2
I've done it this way for my new sGB service, and it works like a charm ;o)
(it's also a heck of alot easier to edit one .asp file, than having to faff
around with thousands of .css/.asp etc file's)

http://guestbook.it-mate.co.uk

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"Mark" <an*******@devdex.com> wrote in message
news:ev**************@TK2MSFTNGP11.phx.gbl...
Hi - in my current pages, I have:

<link href="styles.css" rel="stylesheet" type="text/css">

What I would like to do is:
<!--#include file="config.asp" -->
<!--#include file="styles.asp" -->

config.asp read values from a database, which are used to populate
colours within the styles.asp sheet - for example, styles.asp looks
like:

<style type="text/css">
<!--
a, a:visited { color: <%=acolour%> }
a:hover { colour: <%=ahovcolour%> }
body, td, p {font-size: <%=fontsize%>; color: <%=fontcol%> }
-->
</style>

So, depending on user settings, values read from config.asp will be used
to populate the style sheet which is included in-line, and not
referenced by a link.

Is this a practical way of achieveing different user specific settings
for the same pages?

Is there a reason one way or the other why I shouldn't do it this way?
Is there a better way of giving people a way to customize colours and
other styles for their account?

Thanks for any help.

Mark





*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #3
Hi - so are you talking about the asp page building the output, like:

'
get recordset
'

strCSS=strCSS & "a, a:visited{color:" & rsCSS("acolor") & "}"
strCSS=strCSS & "a:hover{color:" & rsCSS("hovercolor") & "}"

...and so on?

Thanks, Mark


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #4
I think it will be easier to do it this way;

<%
' get recordset
' populate variables, like
acolor = rsCSS("acolor")
%>
a, a:visited{color:<%=acolor%>}

That way your CSS file can still look basically the same, and you won't have
to add all the style blocks that DON'T change (surely not every single class
you define is dependent on the database).

--
http://www.aspfaq.com/
(Reverse address to reply.)
Jul 19 '05 #5
I think it will be easier to do it this way;

<%
' get recordset
' populate variables, like
acolor = rsCSS("acolor")
%>
a, a:visited{color:<%=acolor%>}

That way your CSS file can still look basically the same, and you won't have
to add all the style blocks that DON'T change (surely not every single class
you define is dependent on the database).

--
http://www.aspfaq.com/
(Reverse address to reply.)
Jul 19 '05 #6
"Aaron [SQL Server MVP]" <te*****@dnartreb.noraa> wrote in message
news:eV**************@TK2MSFTNGP09.phx.gbl...
I think it will be easier to do it this way;

<%
' get recordset
' populate variables, like
acolor = rsCSS("acolor")
%>
a, a:visited{color:<%=acolor%>}

That way your CSS file can still look basically the same, and you won't have to add all the style blocks that DON'T change (surely not every single class you define is dependent on the database).


To add to what Aaron has said, you could also create a static default
stylesheet and use the data-driven stylesheet to override on an as\-needed
basis. That way the default stylesheet can potentially benefit from caching.
It also eliminates the need for "filler' data for users who have not
specified custom styling options.
Jul 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Piet | last post by:
Hi there. I have started to work with CSS. For formatting HTML files, the CSS commands can either be be present in the same HTML file via the style-tag <style type="text/css"> <!-- tagname {}...
17
by: Bruce W...1 | last post by:
I don't seem to be getting anywhere with trying to make my web page transitional XHTML. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
4
by: michaaal | last post by:
I have two folders in my website... Folder1 (this is where my #include file is, this is where the style.css is) --Folder2 (Folder2 is inside of Folder1) Folder2 contains a file that has...
12
by: Dave Hammond | last post by:
I recently noticed the stylesheet link in an html page had the href set to a PHP script, as in: <LINK REL="stylesheet" href="some_css.php" type="text/css"> Presumably the file being referenced...
7
by: Don Wash | last post by:
Hi There! I'm creating several ASCX Controls and those controls will have their own CSS Style Sheets. But I don't know how I can link the corresponding Style Sheet in the ASCX file? Because the...
17
by: Eric Lindsay | last post by:
For years I have had links to a stylesheet done like <link rel=stylesheet type="text/css" href="style.css"> and these pages all validate with the W3C validator. However in looking at W3C, I...
3
by: nick | last post by:
I have the following code in my master page: <%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0...
2
by: Rolf Welskes | last post by:
Hello, I have simple in one folder FolderA MyMaster.master and script01.js styles01.css The content pages are in
3
omerbutt
by: omerbutt | last post by:
hi there i am trying to run the lightbox and a slider on a single page the light box is working allrigh but when i try to include the slider in the same page it generates error because i have to...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.