Populate Css Values from database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • .net_developer
    New Member
    • Jul 2006
    • 3

    Populate Css Values from database

    Hello

    I need some help on how to populate CSS style sheet with values from the database? :)
  • sashi
    Recognized Expert Top Contributor
    • Jun 2006
    • 1749

    #2
    Hi there,

    emm.. well.. can be done but you have spare alot of you valuable time in terms of coding.. you might have to create alot of tables as well as fields in your database to store those values.. you will also have write alot of code when it comes to loading those values from your database as well.. good luck my fren.. :)

    Comment

    • .net_developer
      New Member
      • Jul 2006
      • 3

      #3
      Thanks Sashi

      Comment

      • bsw2112
        New Member
        • Jul 2006
        • 6

        #4
        If done well, this could be a cool concept, if done bad your DBA will kick you out of the office. There is a danger of creating a lot of blank fields if you approach this the wrong way. What I would do is build tree tables. That way you will have have no blank fields and hardly any data redundency:

        pardon for the poor English

        ex.

        table CSS class--------------------------------------

        ID
        name
        web_page_ID

        table CSS class attributes----------------------

        ID
        name
        CSS class - FK_ID

        table CSS class attribute values-----------------
        ID
        CSS class attribute - FK_ID
        value


        If you do it like this you DBA will be happy

        bsw
        Last edited by bsw2112; Jul 21 '06, 07:11 PM.

        Comment

        • sashi
          Recognized Expert Top Contributor
          • Jun 2006
          • 1749

          #5
          Hi guys,

          i would suggest using themes instead.. i feel it's more flexible and practical when it comes to .css style sheet..

          Comment

          • Banfa
            Recognized Expert Expert
            • Feb 2006
            • 9067

            #6
            Sorry to pour water on your fire but I recently created a dynamic CSS page using PHP, it used a session variable to control the layout.

            This worked fine in IE but didn't work at all in Firefox. My conclusion was that if you are going to have dynamic CSS then you will either have to
            1. Have static external style sheets and use server side scripting in the HTML to decide which style sheet to link to.
            2. Have internal style sheets, then you can use server side scripting to write the files, but this removes 1 of the advantanges of CSS namely the styles are in an external file and don't need downloading everytime.

            Comment

            Working...