SQL database structure for CSS?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Big Slim

    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!
  • Mr.Clean

    #2
    Re: SQL database structure for CSS?

    In article <1114633159.afc 5e0ddeb0e4458d0 312b537b89968e@ teranews>, skinny@bones.co m says...[color=blue]
    > 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.[/color]

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



    Comment

    • Big Slim

      #3
      Re: SQL database structure for CSS?

      In article <1114635447.805 e218ca45779b776 52af66747f6d39@ teranews>,
      Mr.Clean <mrclean@p&g.co m> wrote:
      [color=blue]
      > In article <1114633159.afc 5e0ddeb0e4458d0 312b537b89968e@ teranews>,
      > skinny@bones.co m says...[color=green]
      > > 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.[/color]
      >
      > AFAICS, you only need one table with fields for:
      > at-rule : String
      > selector : String
      > property : String
      > value : String
      > important : Boolean
      >[/color]

      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.

      Comment

      • Jeff North

        #4
        Re: SQL database structure for CSS?

        On Wed, 27 Apr 2005 16:29:03 -0500, in
        comp.infosystem s.www.authoring.stylesheets Big Slim <skinny@bones.c om>
        wrote:
        [color=blue]
        >| In article <1114635447.805 e218ca45779b776 52af66747f6d39@ teranews>,
        >| Mr.Clean <mrclean@p&g.co m> wrote:
        >|
        >| > In article <1114633159.afc 5e0ddeb0e4458d0 312b537b89968e@ teranews>,
        >| > skinny@bones.co m 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.[/color]

        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.
        ---------------------------------------------------------------
        jnorthau@yourpa ntsyahoo.com.au : Remove your pants to reply
        ---------------------------------------------------------------

        Comment

        • Martin!

          #5
          Re: SQL database structure for CSS?

          Jeff North wrote:[color=blue]
          > On Wed, 27 Apr 2005 16:29:03 -0500, in
          > comp.infosystem s.www.authoring.stylesheets Big Slim <skinny@bones.c om>
          > wrote:
          >
          >[color=green]
          >>| In article <1114635447.805 e218ca45779b776 52af66747f6d39@ teranews>,
          >>| Mr.Clean <mrclean@p&g.co m> wrote:
          >>|
          >>| > In article <1114633159.afc 5e0ddeb0e4458d0 312b537b89968e@ teranews>,
          >>| > skinny@bones.co m 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.[/color]
          >
          >
          > 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.[/color]

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

          Comment

          • Tony

            #6
            Re: SQL database structure for CSS?

            "Big Slim" <skinny@bones.c om> wrote in message
            news:1114633159 .afc5e0ddeb0e44 58d0312b537b899 68e@teranews...[color=blue]
            > 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.[/color]

            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.


            Comment

            • Big Slim

              #7
              Re: SQL database structure for CSS?

              In article <d4q2vt$ll7$1@n ews6.zwoll1.ov. home.nl>, Martin!
              <m.l.smidt@gmai l.komkommer> wrote:
              [color=blue]
              > Jeff North wrote:[color=green]
              > > On Wed, 27 Apr 2005 16:29:03 -0500, in
              > > comp.infosystem s.www.authoring.stylesheets Big Slim <skinny@bones.c om>
              > > wrote:
              > >
              > >[color=darkred]
              > >>| In article <1114635447.805 e218ca45779b776 52af66747f6d39@ teranews>,
              > >>| Mr.Clean <mrclean@p&g.co m> wrote:
              > >>|
              > >>| > In article <1114633159.afc 5e0ddeb0e4458d0 312b537b89968e@ teranews>,
              > >>| > skinny@bones.co m 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.[/color]
              > >
              > >
              > > 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.[/color]
              >
              > make me wonder what the OP's intentions are with this rather complex
              > construction. maybe mr S could elaborate a little on this ?[/color]

              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?

              Comment

              • Greg Schmidt

                #8
                Re: SQL database structure for CSS?

                On Thu, 28 Apr 2005 13:09:48 -0500, Big Slim wrote:
                [color=blue]
                > 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?[/color]

                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,col our) 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 gregs@trawna.co m
                Trawna Publications http://trawna.com/

                Comment

                • Jeff North

                  #9
                  Re: SQL database structure for CSS?

                  On Thu, 28 Apr 2005 13:09:48 -0500, in
                  comp.infosystem s.www.authoring.stylesheets Big Slim <skinny@bones.c om>
                  wrote:
                  [color=blue]
                  >| In article <d4q2vt$ll7$1@n ews6.zwoll1.ov. home.nl>, Martin!
                  >| <m.l.smidt@gmai l.komkommer> wrote:
                  >|
                  >| > Jeff North wrote:
                  >| > > On Wed, 27 Apr 2005 16:29:03 -0500, in
                  >| > > comp.infosystem s.www.authoring.stylesheets Big Slim <skinny@bones.c om>
                  >| > > wrote:
                  >| > >
                  >| > >
                  >| > >>| In article <1114635447.805 e218ca45779b776 52af66747f6d39@ teranews>,
                  >| > >>| Mr.Clean <mrclean@p&g.co m> wrote:
                  >| > >>|
                  >| > >>| > In article <1114633159.afc 5e0ddeb0e4458d0 312b537b89968e@ teranews>,
                  >| > >>| > skinny@bones.co m 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.[/color]

                  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").Valu e;
                  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.
                  [color=blue]
                  >| 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.[/color]

                  Agreed. Your further explanation rules out the need for multiple CSS
                  files.
                  [color=blue]
                  >| 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?[/color]

                  No tables, just a single field in a table.
                  ---------------------------------------------------------------
                  jnorthau@yourpa ntsyahoo.com.au : Remove your pants to reply
                  ---------------------------------------------------------------

                  Comment

                  • Martin!

                    #10
                    Re: SQL database structure for CSS?

                    Big Slim wrote:
                    [color=blue]
                    > In article <d4q2vt$ll7$1@n ews6.zwoll1.ov. home.nl>, Martin!
                    > <m.l.smidt@gmai l.komkommer> wrote:
                    >
                    >[color=green]
                    >>Jeff North wrote:
                    >>[color=darkred]
                    >>>On Wed, 27 Apr 2005 16:29:03 -0500, in
                    >>>comp.infosys tems.www.authoring.stylesheets Big Slim <skinny@bones.c om>
                    >>>wrote:
                    >>>
                    >>>
                    >>>
                    >>>>| In article <1114635447.805 e218ca45779b776 52af66747f6d39@ teranews>,
                    >>>>| Mr.Clean <mrclean@p&g.co m> wrote:
                    >>>>|
                    >>>>| > In article <1114633159.afc 5e0ddeb0e4458d0 312b537b89968e@ teranews>,
                    >>>>| > skinny@bones.co m 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.[/color]
                    >>
                    >>make me wonder what the OP's intentions are with this rather complex
                    >>constructio n. maybe mr S could elaborate a little on this ?[/color]
                    >
                    >
                    > 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?[/color]


                    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

                    Comment

                    Working...