Thread: PHP & CSS

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Norcross, GA
    Posts
    458
    Rep Power
    14
    Is it possible to integrate php in a css page... Er, does a CSS page have to have .css as the extension?
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    18
    I'm not sure if any browsers would choke if you used a .php extension for a css file declaration or not. Give it a shot.

    If all else fails, just use an addtype directive to have PHP parse the css files.

    Of course, if you have a lot of css files and they don't all need to have PHP involved, then you'd be adding extra overhead where it isn't needed....
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 1999
    Location
    Olympia, WA, USA
    Posts
    13
    Rep Power
    0
    Your could put the .css files that need PHP parsing into a specific directory and then declare the addtype in a .htaccess file in that particular folder avoiding the problem that Rod K notes.

    ------------------
    Luke Bowerman
    new media arts
    www.newmediaarts.org

    [This message has been edited by newmediaarts (edited January 05, 2001).]
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Randolph, NJ
    Posts
    36
    Rep Power
    15
    It works fine. I have CSS on .php files at tsrealm.com and it seems to work fine.

    ------------------
    ================
    -Khill, www.tsrealm.com
  8. #5
  9. No Profile Picture
    philip
    Guest
    Devshed Newbie (0 - 499 posts)
    Just make your CSS an include. Using :
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    <STYLE TYPE="text/css">
    [/code]
    is preferred over linking like :
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    LINK REL="stylesheet" HREF="http://www.example.com/my.css" TYPE="text/css">
    [/code]
    as some browsers (albeit old ones) do not enjoy the latter. So including the CSS works very well imho. Also, consider reading this article :
    http://phpbuilder.com/columns/tim20000821.php3

IMN logo majestic logo threadwatch logo seochat tools logo