Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Apr 2007
    Posts
    141
    Thanks
    3
    Thanked 1 Time in 1 Post

    equire ("style/default.css"); or include or whatever . the default.css is parsed as

    iam really annoyed.

    why is my php

    like require ("style/default.css"); or include or whatever .
    the default.css is parsed as text.. all the css values are parsed as text ?

    what is wrong with this ?

    is there anything with php configuration ?
    or what ?

    thanks

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Because you're host isn't set up to parse .css files as PHP. I take it you have php code embedded within you're .css file correct?
    You're two options are to change the extension so its parsed as PHP code, or use an output buffer / include or file reading technique paired with an eval call. The extension is the better option.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #3
    Regular Coder
    Join Date
    Apr 2007
    Posts
    141
    Thanks
    3
    Thanked 1 Time in 1 Post
    which part of the extension do you know ?

    thanks

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Rename default.css to default.php. Place a header in the file:
    PHP Code:
    header("Content-type: text/css"); 
    to serve it as css. I believe this will also allow you to include it using <link rel="stylesheet" type="text/css" href="default.php" /> instead of placing an include/require inside an actual PHP file.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #5
    Senior Coder kbluhm's Avatar
    Join Date
    Apr 2007
    Location
    Philadelphia, PA, USA
    Posts
    1,509
    Thanks
    3
    Thanked 258 Times in 254 Posts
    Also, try readfile() as opposed to requiring/including the file. readfile() won't parse the source, it will simply dump it to the client.

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Quote Originally Posted by kbluhm View Post
    Also, try readfile() as opposed to requiring/including the file. readfile() won't parse the source, it will simply dump it to the client.
    Yeah, that was one of my recommendations as well. File reading with eval would work, but I consider it too much overhead if I can get around it. Well, that and I can never get eval to work correctly. I don't know why, but I'm cursed on that function.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •