467,858 Members | 1,326 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,858 developers. It's quick & easy.

SQL database structure for CSS?

I'm working on a web application that makes heavy use of CSS, but I
would like users to have a degree of control over some of the classes
and attributes. To accomplish this, I want to store my CSS classes in a
SQL database.

The only problem is, I'm having a heck of a time trying to design the
database tables in a normalized way. I have searched high and low for
examples of CSS entity-relationship diagrams--to no avail.

Has anyone here done something similar, and if so, do you have an
example I can borrow? I feel like I'm reinventing the wheel every time
I take a stab at this, and it is difficult trying to visualize how to
separate the tables. It also seems like it is going to be a ton of
work. For example, I am starting to think there will be no end to the
number of tables I'll need: CssColors, CssAlignments, CssFontStyles,
CssFontFamilies, CssBorderStyles, etc.

Help!
Jul 21 '05 #1
  • viewed: 9041
Share:
9 Replies
In article <1114633159.afc5e0ddeb0e4458d0312b537b89968e@teran ews>, sk****@bones.com says...
I'm working on a web application that makes heavy use of CSS, but I
would like users to have a degree of control over some of the classes
and attributes. To accomplish this, I want to store my CSS classes in a
SQL database.

The only problem is, I'm having a heck of a time trying to design the
database tables in a normalized way. I have searched high and low for
examples of CSS entity-relationship diagrams--to no avail.

Has anyone here done something similar, and if so, do you have an
example I can borrow? I feel like I'm reinventing the wheel every time
I take a stab at this, and it is difficult trying to visualize how to
separate the tables. It also seems like it is going to be a ton of
work. For example, I am starting to think there will be no end to the
number of tables I'll need: CssColors, CssAlignments, CssFontStyles,
CssFontFamilies, CssBorderStyles, etc.


AFAICS, you only need one table with fields for:
at-rule : String
selector : String
property : String
value : String
important : Boolean

Jul 21 '05 #2
In article <1114635447.805e218ca45779b77652af66747f6d39@teran ews>,
Mr.Clean <mrclean@p&g.com> wrote:
In article <1114633159.afc5e0ddeb0e4458d0312b537b89968e@teran ews>,
sk****@bones.com says...
I'm working on a web application that makes heavy use of CSS, but I
would like users to have a degree of control over some of the classes
and attributes. To accomplish this, I want to store my CSS classes in a
SQL database.

The only problem is, I'm having a heck of a time trying to design the
database tables in a normalized way. I have searched high and low for
examples of CSS entity-relationship diagrams--to no avail.

Has anyone here done something similar, and if so, do you have an
example I can borrow? I feel like I'm reinventing the wheel every time
I take a stab at this, and it is difficult trying to visualize how to
separate the tables. It also seems like it is going to be a ton of
work. For example, I am starting to think there will be no end to the
number of tables I'll need: CssColors, CssAlignments, CssFontStyles,
CssFontFamilies, CssBorderStyles, etc.


AFAICS, you only need one table with fields for:
at-rule : String
selector : String
property : String
value : String
important : Boolean


True. It would mean I would have to build a lot of constraints for the
columns, though. For instance, I wouldn't want there to be a chance you
could pick an invalid (or non-web-safe) hexadecimal code for the
colors. Also, I wouldn't want to allow invalid font sets, inappropriate
alignment choices, or non-existent border styles.

Even more importantly, though, if several classes share the same font
family or colors, I wouldn't want to have to manage that information in
multiple rows of a single master table.

What if, for example, one user wants to use a blue theme one day and a
green theme the next? I would have to change a hexadecimal value in
multiple rows, rather than one row in one table. Even though I still
can't visualize it, I think there must be a way to normalize CSS
relationships.
Jul 21 '05 #3
On Wed, 27 Apr 2005 16:29:03 -0500, in
comp.infosystems.www.authoring.stylesheets Big Slim <sk****@bones.com>
wrote:
| In article <1114635447.805e218ca45779b77652af66747f6d39@teran ews>,
| Mr.Clean <mrclean@p&g.com> wrote:
|
| > In article <1114633159.afc5e0ddeb0e4458d0312b537b89968e@teran ews>,
| > sk****@bones.com says...
| > > I'm working on a web application that makes heavy use of CSS, but I
| > > would like users to have a degree of control over some of the classes
| > > and attributes. To accomplish this, I want to store my CSS classes in a
| > > SQL database.
| > >
| > > The only problem is, I'm having a heck of a time trying to design the
| > > database tables in a normalized way. I have searched high and low for
| > > examples of CSS entity-relationship diagrams--to no avail.
| > >
| > > Has anyone here done something similar, and if so, do you have an
| > > example I can borrow? I feel like I'm reinventing the wheel every time
| > > I take a stab at this, and it is difficult trying to visualize how to
| > > separate the tables. It also seems like it is going to be a ton of
| > > work. For example, I am starting to think there will be no end to the
| > > number of tables I'll need: CssColors, CssAlignments, CssFontStyles,
| > > CssFontFamilies, CssBorderStyles, etc.
| >
| > AFAICS, you only need one table with fields for:
| > at-rule : String
| > selector : String
| > property : String
| > value : String
| > important : Boolean
| >
|
| True. It would mean I would have to build a lot of constraints for the
| columns, though. For instance, I wouldn't want there to be a chance you
| could pick an invalid (or non-web-safe) hexadecimal code for the
| colors. Also, I wouldn't want to allow invalid font sets, inappropriate
| alignment choices, or non-existent border styles.
|
| Even more importantly, though, if several classes share the same font
| family or colors, I wouldn't want to have to manage that information in
| multiple rows of a single master table.
|
| What if, for example, one user wants to use a blue theme one day and a
| green theme the next? I would have to change a hexadecimal value in
| multiple rows, rather than one row in one table. Even though I still
| can't visualize it, I think there must be a way to normalize CSS
| relationships.


I think that you are making this far too complicated. Your users would
have to have a good grasp of CSS to alter their schemes. You would
also need to write a full blown CSS application (ala TopStyle) just to
maintain the information and valid options.

What I have found is that user wants to have a selection of colour and
layout choices. They want to view the different options and just click
a button. This can be achieved by using predefined CSS files. The user
selection is saved to the database, read when they log in and applied
to each page that they view.
---------------------------------------------------------------
jn******@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Jul 21 '05 #4
Jeff North wrote:
On Wed, 27 Apr 2005 16:29:03 -0500, in
comp.infosystems.www.authoring.stylesheets Big Slim <sk****@bones.com>
wrote:

| In article <1114635447.805e218ca45779b77652af66747f6d39@teran ews>,
| Mr.Clean <mrclean@p&g.com> wrote:
|
| > In article <1114633159.afc5e0ddeb0e4458d0312b537b89968e@teran ews>,
| > sk****@bones.com says...
| > > I'm working on a web application that makes heavy use of CSS, but I
| > > would like users to have a degree of control over some of the classes
| > > and attributes. To accomplish this, I want to store my CSS classes in a
| > > SQL database.
| > >
| > > The only problem is, I'm having a heck of a time trying to design the
| > > database tables in a normalized way. I have searched high and low for
| > > examples of CSS entity-relationship diagrams--to no avail.
| > >
| > > Has anyone here done something similar, and if so, do you have an
| > > example I can borrow? I feel like I'm reinventing the wheel every time
| > > I take a stab at this, and it is difficult trying to visualize how to
| > > separate the tables. It also seems like it is going to be a ton of
| > > work. For example, I am starting to think there will be no end to the
| > > number of tables I'll need: CssColors, CssAlignments, CssFontStyles,
| > > CssFontFamilies, CssBorderStyles, etc.
| >
| > AFAICS, you only need one table with fields for:
| > at-rule : String
| > selector : String
| > property : String
| > value : String
| > important : Boolean
| >
|
| True. It would mean I would have to build a lot of constraints for the
| columns, though. For instance, I wouldn't want there to be a chance you
| could pick an invalid (or non-web-safe) hexadecimal code for the
| colors. Also, I wouldn't want to allow invalid font sets, inappropriate
| alignment choices, or non-existent border styles.
|
| Even more importantly, though, if several classes share the same font
| family or colors, I wouldn't want to have to manage that information in
| multiple rows of a single master table.
|
| What if, for example, one user wants to use a blue theme one day and a
| green theme the next? I would have to change a hexadecimal value in
| multiple rows, rather than one row in one table. Even though I still
| can't visualize it, I think there must be a way to normalize CSS
| relationships.

I think that you are making this far too complicated. Your users would
have to have a good grasp of CSS to alter their schemes. You would
also need to write a full blown CSS application (ala TopStyle) just to
maintain the information and valid options.

What I have found is that user wants to have a selection of colour and
layout choices. They want to view the different options and just click
a button. This can be achieved by using predefined CSS files. The user
selection is saved to the database, read when they log in and applied
to each page that they view.


make me wonder what the OP's intentions are with this rather complex
construction. maybe mr S could elaborate a little on this ?
Jul 21 '05 #5
"Big Slim" <sk****@bones.com> wrote in message
news:1114633159.afc5e0ddeb0e4458d0312b537b89968e@t eranews...
I'm working on a web application that makes heavy use of CSS, but I
would like users to have a degree of control over some of the classes
and attributes. To accomplish this, I want to store my CSS classes in a
SQL database.

The only problem is, I'm having a heck of a time trying to design the
database tables in a normalized way. I have searched high and low for
examples of CSS entity-relationship diagrams--to no avail.

Has anyone here done something similar, and if so, do you have an
example I can borrow? I feel like I'm reinventing the wheel every time
I take a stab at this, and it is difficult trying to visualize how to
separate the tables. It also seems like it is going to be a ton of
work. For example, I am starting to think there will be no end to the
number of tables I'll need: CssColors, CssAlignments, CssFontStyles,
CssFontFamilies, CssBorderStyles, etc.


Are you trying to create user-configurable styles, so users can change their
personal view, sort of like how they can change their Windows appearance
settings? If so, please provide me with a few more details - this sounds a
little like something I'm working on at present. Perhaps what I'm doing
would have some relevance.
Jul 21 '05 #6
In article <d4**********@news6.zwoll1.ov.home.nl>, Martin!
<m.*******@gmail.komkommer> wrote:
Jeff North wrote:
On Wed, 27 Apr 2005 16:29:03 -0500, in
comp.infosystems.www.authoring.stylesheets Big Slim <sk****@bones.com>
wrote:

| In article <1114635447.805e218ca45779b77652af66747f6d39@teran ews>,
| Mr.Clean <mrclean@p&g.com> wrote:
|
| > In article <1114633159.afc5e0ddeb0e4458d0312b537b89968e@teran ews>,
| > sk****@bones.com says...
| > > I'm working on a web application that makes heavy use of CSS, but I
| > > would like users to have a degree of control over some of the classes
| > > and attributes. To accomplish this, I want to store my CSS classes in
| > > a
| > > SQL database.
| > >
| > > The only problem is, I'm having a heck of a time trying to design the
| > > database tables in a normalized way. I have searched high and low for
| > > examples of CSS entity-relationship diagrams--to no avail.
| > >
| > > Has anyone here done something similar, and if so, do you have an
| > > example I can borrow? I feel like I'm reinventing the wheel every time
| > > I take a stab at this, and it is difficult trying to visualize how to
| > > separate the tables. It also seems like it is going to be a ton of
| > > work. For example, I am starting to think there will be no end to the
| > > number of tables I'll need: CssColors, CssAlignments, CssFontStyles,
| > > CssFontFamilies, CssBorderStyles, etc.
| >
| > AFAICS, you only need one table with fields for:
| > at-rule : String
| > selector : String
| > property : String
| > value : String
| > important : Boolean
| >
|
| True. It would mean I would have to build a lot of constraints for the
| columns, though. For instance, I wouldn't want there to be a chance you
| could pick an invalid (or non-web-safe) hexadecimal code for the
| colors. Also, I wouldn't want to allow invalid font sets, inappropriate
| alignment choices, or non-existent border styles.
|
| Even more importantly, though, if several classes share the same font
| family or colors, I wouldn't want to have to manage that information in
| multiple rows of a single master table.
|
| What if, for example, one user wants to use a blue theme one day and a
| green theme the next? I would have to change a hexadecimal value in
| multiple rows, rather than one row in one table. Even though I still
| can't visualize it, I think there must be a way to normalize CSS
| relationships.

I think that you are making this far too complicated. Your users would
have to have a good grasp of CSS to alter their schemes. You would
also need to write a full blown CSS application (ala TopStyle) just to
maintain the information and valid options.

What I have found is that user wants to have a selection of colour and
layout choices. They want to view the different options and just click
a button. This can be achieved by using predefined CSS files. The user
selection is saved to the database, read when they log in and applied
to each page that they view.


make me wonder what the OP's intentions are with this rather complex
construction. maybe mr S could elaborate a little on this ?


My intention goes along these lines: a financial web application I am
writing (in Java) retrieves thousands of rows of data from a database.
Depending on the values in one (or more) of the columns, a particular
row of data may or may not be highlighted (i.e., mapped to a particular
CSS class). Also, the highlight color of the row may change depending
on exactly which value appears in the particular column.

An oversimplified example: say there is a price-change column. When the
value in this column is negative, the entire row gets highlighted in
red. When the value is positive, but below a certain number, the row is
not highlighted. When the value is above the threshold number, the row
gets highlighted in blue. Above another number, the row gets
highlighted in green, etc.

Users want to change these highlighting colors to suite their own
tastes. They can already change filters that determine when rows will
be highlighted anyway.

I don't want to deal with separate CSS files. In fact, I don't want any
CSS files at all. Instead, the CSS should be generated dynamically at
compile time in the HEAD area of the page based on CSS information in a
set of SQL tables that get joined to a user account table.

The question is, how would you organize these SQL tables in a way that
is normalized? I wonder if this question belongs in another NG?
Jul 21 '05 #7
On Thu, 28 Apr 2005 13:09:48 -0500, Big Slim wrote:
My intention goes along these lines: a financial web application I am
writing (in Java) retrieves thousands of rows of data from a database.
Depending on the values in one (or more) of the columns, a particular
row of data may or may not be highlighted (i.e., mapped to a particular
CSS class). Also, the highlight color of the row may change depending
on exactly which value appears in the particular column.

An oversimplified example: say there is a price-change column. When the
value in this column is negative, the entire row gets highlighted in
red. When the value is positive, but below a certain number, the row is
not highlighted. When the value is above the threshold number, the row
gets highlighted in blue. Above another number, the row gets
highlighted in green, etc.

Users want to change these highlighting colors to suite their own
tastes. They can already change filters that determine when rows will
be highlighted anyway.

I don't want to deal with separate CSS files. In fact, I don't want any
CSS files at all. Instead, the CSS should be generated dynamically at
compile time in the HEAD area of the page based on CSS information in a
set of SQL tables that get joined to a user account table.

The question is, how would you organize these SQL tables in a way that
is normalized? I wonder if this question belongs in another NG?


Are you only changing colours, or is that just because this is the
"oversimplified" example? From this short example, it sounds like you
must already have some structure for user->threshold lookups. Just add
another column to that, so you do user->(threshold,colour) lookups, and
you're all set. You have to read the thresholds before starting the
report anyway, so so you can grab the colours and generate the CSS in
the header at the same time.

If the real-world version is more complicated, then the solution is
probably also more complicated. Hopefully this points you in the right
direction.

As a side note, which may apply here, I've found that it's best to
design for what you need right now, and accept that you may need to
redesign parts of it later, rather than try to design for all potential
features from the get-go. 90% of the features you allow for will never
get used, and designing them all will take longer than redesigning the
10% you do need when you find that you need it.

--
Greg Schmidt gr***@trawna.com
Trawna Publications http://trawna.com/
Jul 21 '05 #8
On Thu, 28 Apr 2005 13:09:48 -0500, in
comp.infosystems.www.authoring.stylesheets Big Slim <sk****@bones.com>
wrote:
| In article <d4**********@news6.zwoll1.ov.home.nl>, Martin!
| <m.*******@gmail.komkommer> wrote:
|
| > Jeff North wrote:
| > > On Wed, 27 Apr 2005 16:29:03 -0500, in
| > > comp.infosystems.www.authoring.stylesheets Big Slim <sk****@bones.com>
| > > wrote:
| > >
| > >
| > >>| In article <1114635447.805e218ca45779b77652af66747f6d39@teran ews>,
| > >>| Mr.Clean <mrclean@p&g.com> wrote:
| > >>|
| > >>| > In article <1114633159.afc5e0ddeb0e4458d0312b537b89968e@teran ews>,
| > >>| > sk****@bones.com says...
| > >>| > > I'm working on a web application that makes heavy use of CSS, but I
| > >>| > > would like users to have a degree of control over some of the classes
| > >>| > > and attributes. To accomplish this, I want to store my CSS classes in
| > >>| > > a
| > >>| > > SQL database.
| > >>| > >
| > >>| > > The only problem is, I'm having a heck of a time trying to design the
| > >>| > > database tables in a normalized way. I have searched high and low for
| > >>| > > examples of CSS entity-relationship diagrams--to no avail.
| > >>| > >
| > >>| > > Has anyone here done something similar, and if so, do you have an
| > >>| > > example I can borrow? I feel like I'm reinventing the wheel every time
| > >>| > > I take a stab at this, and it is difficult trying to visualize how to
| > >>| > > separate the tables. It also seems like it is going to be a ton of
| > >>| > > work. For example, I am starting to think there will be no end to the
| > >>| > > number of tables I'll need: CssColors, CssAlignments, CssFontStyles,
| > >>| > > CssFontFamilies, CssBorderStyles, etc.
| > >>| >
| > >>| > AFAICS, you only need one table with fields for:
| > >>| > at-rule : String
| > >>| > selector : String
| > >>| > property : String
| > >>| > value : String
| > >>| > important : Boolean
| > >>| >
| > >>|
| > >>| True. It would mean I would have to build a lot of constraints for the
| > >>| columns, though. For instance, I wouldn't want there to be a chance you
| > >>| could pick an invalid (or non-web-safe) hexadecimal code for the
| > >>| colors. Also, I wouldn't want to allow invalid font sets, inappropriate
| > >>| alignment choices, or non-existent border styles.
| > >>|
| > >>| Even more importantly, though, if several classes share the same font
| > >>| family or colors, I wouldn't want to have to manage that information in
| > >>| multiple rows of a single master table.
| > >>|
| > >>| What if, for example, one user wants to use a blue theme one day and a
| > >>| green theme the next? I would have to change a hexadecimal value in
| > >>| multiple rows, rather than one row in one table. Even though I still
| > >>| can't visualize it, I think there must be a way to normalize CSS
| > >>| relationships.
| > >
| > >
| > > I think that you are making this far too complicated. Your users would
| > > have to have a good grasp of CSS to alter their schemes. You would
| > > also need to write a full blown CSS application (ala TopStyle) just to
| > > maintain the information and valid options.
| > >
| > > What I have found is that user wants to have a selection of colour and
| > > layout choices. They want to view the different options and just click
| > > a button. This can be achieved by using predefined CSS files. The user
| > > selection is saved to the database, read when they log in and applied
| > > to each page that they view.
| >
| > make me wonder what the OP's intentions are with this rather complex
| > construction. maybe mr S could elaborate a little on this ?
|
| My intention goes along these lines: a financial web application I am
| writing (in Java) retrieves thousands of rows of data from a database.
| Depending on the values in one (or more) of the columns, a particular
| row of data may or may not be highlighted (i.e., mapped to a particular
| CSS class). Also, the highlight color of the row may change depending
| on exactly which value appears in the particular column.
|
| An oversimplified example: say there is a price-change column. When the
| value in this column is negative, the entire row gets highlighted in
| red. When the value is positive, but below a certain number, the row is
| not highlighted. When the value is above the threshold number, the row
| gets highlighted in blue. Above another number, the row gets
| highlighted in green, etc.
|
| Users want to change these highlighting colors to suite their own
| tastes. They can already change filters that determine when rows will
| be highlighted anyway.
If they only want to change the colours then there is no need for the
complicated rules that you are planning.

In an application that I wrote I allowed the user to change 7
properties, main background colour, font colour, border styles and
colours and layout modes.

I stored this information in a single field in the database i.e.
#FF00FF|#00FF00|1 px solid #FF0000 etc

The server-side would get this data, split it apart and write out the
necessary ccs statements. In jscript it looked like:

var CSS = db.Fields.Item("CSS").Value;
var CSSArray = new Array();
CSSArray = CSS.Split("|");

to generate the client-side CSS I used:

<style>
..mainBG {
background-color: <%=CSSArray[0]%>;
color: <%=CSSArray[3]%>
margin: 0;
padding: 0 4px 0 6px;
}
..hilite { color : <%=CSSArray[1]%>; }
..boxed { <%=CSSArray[2]%>; }
etc etc

The user configuration page consisted only of the items that they were
allowed to change.

If the user wanted a style like:
..mainBG {
background-color: #9400D3;
color: #FF00FF;
font-family: cursive;
font-size: 10px;
font-weight: bold;
}

my coding didn't stop them from having what they wanted. Believe me
someone actually wanted this scheme and dispite the advice from myself
and 2 other graphic designers the user still persisted. It wasn't
until they started getting complaints from their users that they
decided on a different scheme.

The moral of the story: not everyone is a graphic designer (including
myself) so it is up to you, the programmer, to note the users
limitations and set your rules accordingly.

Your configuration page would control the rules i.e. if the user
selected a light colour background then you must offer them an
appropriate contrasting colour for the text colour.

Also, if the user forgot to set an option you must either prompt the
user to set it or user an appropriate default i.e. if the user
selected a dark green background then you wouldn't want the default
text colour of black.
| I don't want to deal with separate CSS files. In fact, I don't want any
| CSS files at all. Instead, the CSS should be generated dynamically at
| compile time in the HEAD area of the page based on CSS information in a
| set of SQL tables that get joined to a user account table.
Agreed. Your further explanation rules out the need for multiple CSS
files.
| The question is, how would you organize these SQL tables in a way that
| is normalized? I wonder if this question belongs in another NG?


No tables, just a single field in a table.
---------------------------------------------------------------
jn******@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Jul 21 '05 #9
Big Slim wrote:
In article <d4**********@news6.zwoll1.ov.home.nl>, Martin!
<m.*******@gmail.komkommer> wrote:

Jeff North wrote:
On Wed, 27 Apr 2005 16:29:03 -0500, in
comp.infosystems.www.authoring.stylesheets Big Slim <sk****@bones.com>
wrote:

| In article <1114635447.805e218ca45779b77652af66747f6d39@teran ews>,
| Mr.Clean <mrclean@p&g.com> wrote:
|
| > In article <1114633159.afc5e0ddeb0e4458d0312b537b89968e@teran ews>,
| > sk****@bones.com says...
| > > I'm working on a web application that makes heavy use of CSS, but I
| > > would like users to have a degree of control over some of the classes
| > > and attributes. To accomplish this, I want to store my CSS classes in
| > > a
| > > SQL database.
| > >
| > > The only problem is, I'm having a heck of a time trying to design the
| > > database tables in a normalized way. I have searched high and low for
| > > examples of CSS entity-relationship diagrams--to no avail.
| > >
| > > Has anyone here done something similar, and if so, do you have an
| > > example I can borrow? I feel like I'm reinventing the wheel every time
| > > I take a stab at this, and it is difficult trying to visualize how to
| > > separate the tables. It also seems like it is going to be a ton of
| > > work. For example, I am starting to think there will be no end to the
| > > number of tables I'll need: CssColors, CssAlignments, CssFontStyles,
| > > CssFontFamilies, CssBorderStyles, etc.
| >
| > AFAICS, you only need one table with fields for:
| > at-rule : String
| > selector : String
| > property : String
| > value : String
| > important : Boolean
| >
|
| True. It would mean I would have to build a lot of constraints for the
| columns, though. For instance, I wouldn't want there to be a chance you
| could pick an invalid (or non-web-safe) hexadecimal code for the
| colors. Also, I wouldn't want to allow invalid font sets, inappropriate
| alignment choices, or non-existent border styles.
|
| Even more importantly, though, if several classes share the same font
| family or colors, I wouldn't want to have to manage that information in
| multiple rows of a single master table.
|
| What if, for example, one user wants to use a blue theme one day and a
| green theme the next? I would have to change a hexadecimal value in
| multiple rows, rather than one row in one table. Even though I still
| can't visualize it, I think there must be a way to normalize CSS
| relationships.
I think that you are making this far too complicated. Your users would
have to have a good grasp of CSS to alter their schemes. You would
also need to write a full blown CSS application (ala TopStyle) just to
maintain the information and valid options.

What I have found is that user wants to have a selection of colour and
layout choices. They want to view the different options and just click
a button. This can be achieved by using predefined CSS files. The user
selection is saved to the database, read when they log in and applied
to each page that they view.


make me wonder what the OP's intentions are with this rather complex
construction. maybe mr S could elaborate a little on this ?

My intention goes along these lines: a financial web application I am
writing (in Java) retrieves thousands of rows of data from a database.
Depending on the values in one (or more) of the columns, a particular
row of data may or may not be highlighted (i.e., mapped to a particular
CSS class). Also, the highlight color of the row may change depending
on exactly which value appears in the particular column.

An oversimplified example: say there is a price-change column. When the
value in this column is negative, the entire row gets highlighted in
red. When the value is positive, but below a certain number, the row is
not highlighted. When the value is above the threshold number, the row
gets highlighted in blue. Above another number, the row gets
highlighted in green, etc.

Users want to change these highlighting colors to suite their own
tastes. They can already change filters that determine when rows will
be highlighted anyway.

I don't want to deal with separate CSS files. In fact, I don't want any
CSS files at all. Instead, the CSS should be generated dynamically at
compile time in the HEAD area of the page based on CSS information in a
set of SQL tables that get joined to a user account table.

The question is, how would you organize these SQL tables in a way that
is normalized? I wonder if this question belongs in another NG?

i think what Greg is saying is right.
you could make 1 css file that includes all the variations of styles you
want to use and when you dynamically generate the html you can evaluate
the columns and rows and insert the proper classes to your rows and/or
cells.
remember that css only structures some mark-up issues and is best
conciderred a static part of your html.
and indeed, for the dynamic generation of your code you better ask your
questions in other newsgroups.

gl
martin
Jul 21 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by bryja_klaudiusz[at]poczta[dot]fm | last post: by
1 post views Thread by Srihari | last post: by
346 posts views Thread by rkusenet | last post: by
25 posts views Thread by Colin McKinnon | last post: by
3 posts views Thread by josh.kuo | last post: by
8 posts views Thread by situ | last post: by
9 posts views Thread by Peter Duniho | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.