...

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



likon
08-05-2008, 08:15 AM
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

Fou-Lu
08-05-2008, 08:29 AM
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.

likon
08-05-2008, 08:40 AM
which part of the extension do you know ?

thanks

Fou-Lu
08-05-2008, 09:10 AM
Rename default.css to default.php. Place a header in the file:


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.

kbluhm
08-05-2008, 05:58 PM
Also, try readfile() as opposed to requiring/including the file. readfile() won't parse the source, it will simply dump it to the client.

Fou-Lu
08-05-2008, 10:47 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum