SitePoint Sponsor |
|
User Tag List
Results 1 to 18 of 18
Thread: PHP doesn't process CSS pages?
-
Oct 7, 2008, 08:43 #1
- Join Date
- Feb 2007
- Location
- Southern California
- Posts
- 1,388
- Mentioned
- 1 Post(s)
- Tagged
- 1 Thread(s)
PHP doesn't process CSS pages?
I uploaded my PHP and CSS pages to my new external server at CrystalTech. The CSS pages did not style the PHP pages. Upon asking Support about this, here is the answer I got:
"I've found the issue. PHP does not process the actual .css file extention. So if you notice in your /css directory all your .css files are now .php. You'll need to update all your css links to reflect the new .php extention. I tested this and you can see it on the home page of the site. "
Is it true that pages with a php extension (not talking about includes) does not process css? I've never heard of that. Will I have to change my php extensions to htm to make the css work?
Thanks for any light you can shed on this issue.
Steve
-
Oct 7, 2008, 08:58 #2
- Join Date
- Oct 2006
- Location
- France, deep rural.
- Posts
- 6,869
- Mentioned
- 17 Post(s)
- Tagged
- 1 Thread(s)
It sounds as if they think your css files have got PHP instructions in them.
PHP Code://stuff like this
<?php
if( true )
echo '.bold {font-weight: bold ;}';
?>
Or do they contain straight css rules?
Code:.bold { font-weight: bold ; }
-
Oct 7, 2008, 08:58 #3
Your CSS is best included in the <head> parto of your page ( HTML).
If you are not doing a "require()" or "include()", the php has nothing to do with your css to be honest - unless I am misunderstanding the entire problem.
One way to include a style sheet would be as follows
Code HTML4Strict:<link type="text/css" rel="Stylesheet" href="inc/style.css">
I copied this line from a working system (index.php) - so it works - that I can guarantee you !!______________________
Enjoying life is not about what you get from it ....
...... but how you perceive what you get
www.jerilimited.co.uk
-
Oct 7, 2008, 09:06 #4
- Join Date
- Feb 2007
- Location
- Southern California
- Posts
- 1,388
- Mentioned
- 1 Post(s)
- Tagged
- 1 Thread(s)
I am using this method to call the CSS.
PHP Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="../css/search.css" />
<link rel="stylesheet" type="text/css" media="print" href="../css/search_print.css" />
<title>Power</title>
</head>
PHP Code:echo "<td class='celltable'>";
echo "<p style='text-align:center' padding-top:'10px'><strong>$PartNo</strong><br />$ItemName</p><div class=$Brand>$thumb</div>\n";
I forgot to mention that the php/css system worked just fine in WAMP on my machine. It failed only after I uploaded the folders to my external server - same folder configuration as my local machine.
Thanks,
SteveLast edited by StevenHu; Oct 7, 2008 at 09:09. Reason: [added last paragraph.]
-
Oct 7, 2008, 09:12 #5
- Join Date
- Oct 2006
- Location
- France, deep rural.
- Posts
- 6,869
- Mentioned
- 17 Post(s)
- Tagged
- 1 Thread(s)
I cannot see anything you are doing wrong there.
Edit:
Thats a potential error in addressing
<link rel="stylesheet" type="text/css" href="../css/search.css" />
if /css is a top level directory why not just stick with the simpler:
<link rel="stylesheet" type="text/css" href="/css/search.css" />
-
Oct 7, 2008, 09:12 #6
- Join Date
- Jul 2008
- Posts
- 5,757
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Why do you think php has anything to do with this?
Do your .css files contain php code? If not, this is not a php issue.
-
Oct 7, 2008, 09:16 #7
- Join Date
- Feb 2007
- Location
- Southern California
- Posts
- 1,388
- Mentioned
- 1 Post(s)
- Tagged
- 1 Thread(s)
The CSS is in the head of my php pages. My external CSS has always worked with my html pages. Now that I'm into PHP, the CSS has stopped working once uploaded. I am trying to figure out if the php extension is the culprit, and if so, whether I should rename my php pages, except for the includes, as htm.
However, the php/css pages have worked fine on my local WAMP machine.
That's why I put this in a PHP thread. I thought more php coders would know about css than css people about php.
Steve
-
Oct 7, 2008, 09:32 #8
-
Oct 7, 2008, 09:33 #9
- Join Date
- Feb 2007
- Location
- Southern California
- Posts
- 1,388
- Mentioned
- 1 Post(s)
- Tagged
- 1 Thread(s)
-
Oct 7, 2008, 09:53 #10
- Join Date
- Jul 2008
- Posts
- 5,757
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
This has nothing to do with php. Probably not your hosts fault either.
I'm going to bet you have not set your url paths correctly.
Make the urls absolute to test, eg
Code:instead of <link rel="stylesheet" type="text/css" href="../css/search.css" /> use <link rel="stylesheet" type="text/css" href="http://example.com/css/search.css" />
Clear your browser cache.
-
Oct 7, 2008, 11:08 #11
- Join Date
- Feb 2007
- Location
- Southern California
- Posts
- 1,388
- Mentioned
- 1 Post(s)
- Tagged
- 1 Thread(s)
I made them absolute. That did not work either. The pages don't work with an htm extension either. Puzzling.
Isn't the php on an html page supposed to work anyway if all the php is wrapped in the php tags? That's how my php pages are set up. Normal html is outside the php tags, and all php is inside the php tags.
SteveLast edited by StevenHu; Oct 7, 2008 at 11:13. Reason: added second para
-
Oct 7, 2008, 11:15 #12
- Join Date
- Jul 2008
- Posts
- 5,757
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
And when you goto
http://example.com/css/search.css
in your browser, can you see the css text?
Can you post a link to one of the pages which is not working?
-
Oct 7, 2008, 11:30 #13
- Join Date
- Feb 2007
- Location
- Southern California
- Posts
- 1,388
- Mentioned
- 1 Post(s)
- Tagged
- 1 Thread(s)
OK, get a permission denied notice, #403. That means the css page can't be read by the system. I had checked the permission files and the pages are marked for Read and Execute for everyone. So there seems to be a bug in their system. I'll get on this with their support and see what they think.
Everything worked fine on my system, then I had uploaded the folders as is, with the same file/folder relationships. It seems to be CrystalTech's problem at this point.
-
Oct 7, 2008, 16:04 #14
-
Oct 8, 2008, 09:05 #15
- Join Date
- Feb 2007
- Location
- Southern California
- Posts
- 1,388
- Mentioned
- 1 Post(s)
- Tagged
- 1 Thread(s)
Here is Support's reply:
"What I have done so far is mapped the .css to the PHP5 executable."
It seems that he needed to go into php.ini or somewhere to get it working. Now it works as expected in IE, but does not work in FF!
According to the site, I can set permissions by clicking on checkboxes, for Everyone, Myself, and the system. The Read and Execute files have been checked, so that is not hindering. The main folder has Read enabled.
I'll get back to Support to ask why it doesn't work in FF. Very curious!
Steve
-
Oct 8, 2008, 09:11 #16
- Join Date
- Sep 2006
- Location
- Nottingham, UK
- Posts
- 3,133
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
I can give you that answer here.
Since the CSS files are now interpreted by PHP, they will come back from the browser with a content type of text/plain, whereas css files are normally text/css. Internet Explorer ignores this difference, but firefox doesn't.
Either stop the css files being interpreted by php (unless you need it), or add this to the top of every file, on the first line - no content can appear before it in each file:
PHP Code:<?php header("Content-type: text/css"); ?>
-
Oct 8, 2008, 09:21 #17
- Join Date
- Jul 2008
- Posts
- 5,757
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I think you confused your tech guy.
Like when you came here, you had this idea that your problem was somehow related to php. It's not related to php at all. You would have the exact same problem if php had never existed and you only used .html files.
You have probably given him the impression that you want php to parse your css files. You don't. Having php parse css files when you don't need it to will destroy the browsers ability to cache the files(unless you want to write a php script which will send proper cache headers and properly respond to conditional http requests...don't go there), not to mention they will load slower.
Tell him not to have php parse the css files. Then link to a css file and show him the permission denied error, because that is the problem here.
-
Oct 8, 2008, 09:29 #18
- Join Date
- Feb 2007
- Location
- Southern California
- Posts
- 1,388
- Mentioned
- 1 Post(s)
- Tagged
- 1 Thread(s)
crmalibu, I think you're right. I'll let Support know.
Stormrider, I tried your suggestion. Unfortunately, all the files appear on my WAMP as text. I'd like the native files to work on both servers, so I'll remove the notice.
Thanks!
Bookmarks