Creating Dynanmic CSS File

Discussion in 'PHP' started by Kalyse, Apr 19, 2007.

  1. #1
    I am about to start the module on my CMS where I create a CSS file through the control panel.

    The question is, should I create it and write to a file, or should I do it from a database and create a CSS file for each user using mod rewrite?


    Can someone give me some ideas.
     
    Kalyse, Apr 19, 2007 IP
  2. math20

    math20 Peon

    Messages:
    1,562
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If you require many different users mysql would be best as it is easier to organize and sort.
     
    math20, Apr 19, 2007 IP
  3. decepti0n

    decepti0n Peon

    Messages:
    519
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I'd go with files, having a styles directory, and a field in the user table that gets called each page load anyway, and sets the appropriate path

    That or cookies
     
    decepti0n, Apr 19, 2007 IP
  4. Kalyse

    Kalyse Peon

    Messages:
    1,221
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I should have maybe clarified more.

    I will be loading all the settings and styles for the CSS file from a table in a mysql database. Atlest they are all stored there.
     
    Kalyse, Apr 19, 2007 IP
  5. Chamaro Zwinkels

    Chamaro Zwinkels Peon

    Messages:
    44
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Maybe you can use this:

    your style.css do you call style.php

    You can (re-)write you .php file (see php.net) and then you only need a .htaccess file with:

    RewriteEngine On

    RewriteRule ^style.css$ style.php
     
    Chamaro Zwinkels, Apr 19, 2007 IP
  6. Vetsin

    Vetsin Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    word press seems to do it by just loading the contents of the css file, throwing it into a box you can edit. When you save, it over-writes the original .css file. Seems to be the way to go.
     
    Vetsin, Apr 20, 2007 IP
  7. Kalyse

    Kalyse Peon

    Messages:
    1,221
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Yeah, thats just editing.

    I quite like the way VBulletin does it.

    I think Im going ot do it that way.

    Does anyone know a way to check to see which classes and ids are actually used.

    My static CSS file has arond 200 classes, I just kept adding and not deleting.... I want to prune them all quickly by checking my whole site to see if they are in use.. any idea?
     
    Kalyse, Apr 20, 2007 IP
  8. Vetsin

    Vetsin Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    To check if the classes are in use... Try the firebug extension in firefox. Trying to code something to prune it would most likely take longer than manually looking them up with firebug.
     
    Vetsin, Apr 20, 2007 IP