CSS using PHP
Moderator: General Moderators
-
waimichael
- Forum Newbie
- Posts: 6
- Joined: Tue Mar 23, 2004 9:56 pm
- Location: Hong Kong
CSS using PHP
I always use the xxx.css.php for my CSS file that can include detect the browsers and OS, then use the suitable fonts and size. However, when I'm working in a new server recently, I can't use this technique. The Mozilla cannot run the xxx.css.php file, but can run the xxx.css. IE and Opera don't have this problem.
Would anyone tell me what the problem is and how to solve it? The server is using SUSE 8.0 with PHP 4.3.1 with Zend Optimizer V2.1.0 and MySQL 3.23.55.
Thanks.
Would anyone tell me what the problem is and how to solve it? The server is using SUSE 8.0 with PHP 4.3.1 with Zend Optimizer V2.1.0 and MySQL 3.23.55.
Thanks.
-
compound_eye
- Forum Newbie
- Posts: 15
- Joined: Wed Mar 17, 2004 8:42 pm
sorry, this isn't an answer but a question,
i had exactly the same problem using IIS as a server, and I thought that it was netscape, not able to handle a css without the extesion *.css, not realizing it might be a server problem, so i ended up including all my styles in the head of the HTML document rather than linking to an external file,
so did mozilla work with a style sheet with a *.php extension on another server?
i wonder if there is anything in the way themime type for a style sheet is set up on the new server? ( this is not an expert suggestion just a co-confused wondering)
an alternative might be to have six or so static css files and just dynamically specify the correct sheet in your output depending on the font size you want the
i had exactly the same problem using IIS as a server, and I thought that it was netscape, not able to handle a css without the extesion *.css, not realizing it might be a server problem, so i ended up including all my styles in the head of the HTML document rather than linking to an external file,
so did mozilla work with a style sheet with a *.php extension on another server?
i wonder if there is anything in the way themime type for a style sheet is set up on the new server? ( this is not an expert suggestion just a co-confused wondering)
an alternative might be to have six or so static css files and just dynamically specify the correct sheet in your output depending on the font size you want the
Code: Select all
<?PHP
$styleSheet = 'style_'.$browser. '_'. $size. '.css';
?>...
...<!-- link rel="stylesheet" href="<?PHP echo $styleSheet; ?>" type="text/css" -->-
waimichael
- Forum Newbie
- Posts: 6
- Joined: Tue Mar 23, 2004 9:56 pm
- Location: Hong Kong
Thanks for your info compound_eye.
I don't think that Netscape can't handle the css without end in .css. In my personal website (the other web hosting company) it works well on IE, Netscape, Mozilla and Opera. So I think it should be the setting problem of PHP or Apache.
Would anyone have idea about it? Comments are welcome ~
I don't think that Netscape can't handle the css without end in .css. In my personal website (the other web hosting company) it works well on IE, Netscape, Mozilla and Opera. So I think it should be the setting problem of PHP or Apache.
Would anyone have idea about it? Comments are welcome ~
-
waimichael
- Forum Newbie
- Posts: 6
- Joined: Tue Mar 23, 2004 9:56 pm
- Location: Hong Kong
-
waimichael
- Forum Newbie
- Posts: 6
- Joined: Tue Mar 23, 2004 9:56 pm
- Location: Hong Kong
Code: Select all
AddType text/css .php-Nay
Hey, it's open to debate. I remember reading somewhere that .htaccess files should only be used where necessarry, instead configuration should be done in httpd.conf where possible, ever authentication.Nay wrote:I believe .htaccess rather than httpd.conf? I've never used httpd.conf to add extensions. Just make a .htaccess file containing that line and drop it into the CSS directory.Code: Select all
AddType text/css .php
-Nay
Might be wrong though.
If your going to use htaccess, make sure you set AllowOverride to "All"
-
waimichael
- Forum Newbie
- Posts: 6
- Joined: Tue Mar 23, 2004 9:56 pm
- Location: Hong Kong
-
waimichael
- Forum Newbie
- Posts: 6
- Joined: Tue Mar 23, 2004 9:56 pm
- Location: Hong Kong
Thanks McGruff for your suggestion.
One question is that now I have two set of CSS file: one is .css and other one is .css.php. If I modified one, I have to modify the other one. It's easy to make mistake and hard to maintain the codes. If I use the PHP script to pick one, that's mean I have to seperate several sets of CSS for each browser ... isn't it?
One question is that now I have two set of CSS file: one is .css and other one is .css.php. If I modified one, I have to modify the other one. It's easy to make mistake and hard to maintain the codes. If I use the PHP script to pick one, that's mean I have to seperate several sets of CSS for each browser ... isn't it?
-
compound_eye
- Forum Newbie
- Posts: 15
- Joined: Wed Mar 17, 2004 8:42 pm