SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Wizard ryanhellyer's Avatar
    Join Date
    Oct 2006
    Location
    New Zealand
    Posts
    2,323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CSS file not rendering

    Hi,
    I've been trying to help a user of my dropdown menu plugin with a problem.

    For some reason, their CSS file (style.php) is not rendering on their page. It can be access directly, but when used within the page it does not seem to be working The response headers indicate that the CSS file is indeed being sent as text/css and I can download the page, change the link to a local .css file and it works fine.

    The site in question is here ... http://www.routinefly.com/testing-grounds/


    Any ideas what on earth is going on? I have never seen this sort of behaviour before.

  2. #2
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,495
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why is it being saved as a .php file?

  3. #3
    SitePoint Wizard ryanhellyer's Avatar
    Join Date
    Oct 2006
    Location
    New Zealand
    Posts
    2,323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dan Schulz View Post
    Why is it being saved as a .php file?
    Because some parts of the CSS file are dynamically generated on each page load. It is served as text/css though so it should work fine.

    You can see it in action on my test blog where it works fine with a style.php file ... http://pixopoint.com/demo/wordpress/...pdown%20Plugin

  4. #4
    SitePoint Wizard ryanhellyer's Avatar
    Join Date
    Oct 2006
    Location
    New Zealand
    Posts
    2,323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    BUMP!

    I have another user with exactly the same problem now. I badly need to find the cause of this issue. Anyone have any ideas?

    I've set up a demo of the problem in action. The first menu displays correct, it is using a style.php file from my own site. The second one uses a style.php from one my plugin users sites, it doesn't render the menus CSS at all, despite the CSS file being directly accessible via a browser AND being served as text/css. Even the web developers toolbar picks it up as a regular CSS file

    http://pixopoint.com/demo/test/temp/...luginbug1.html

  5. #5
    SitePoint Wizard ryanhellyer's Avatar
    Join Date
    Oct 2006
    Location
    New Zealand
    Posts
    2,323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I forgot to add that users are claiming this is occurring after switching their WordPress permalinks. One user reported it when using the following permalink structure ... /category/year/month/day/blog

    This seems completely nonsensical to me as the permalinks should have absolutely zero impact on how a separate script held within my plugin is operating. And the script is simply generating a CSS file, so the question about why the CSS is not rendering on the page still remains.


    I've posted a support topic on the WordPress.org forums about this now too, but I haven't had much luck getting help there in the past so I'm not holding out much hope http://wordpress.org/support/topic/175052

  6. #6
    SitePoint Wizard ryanhellyer's Avatar
    Join Date
    Oct 2006
    Location
    New Zealand
    Posts
    2,323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    One of my plugins users has noticed that on my demo page, the style.php which works is downloadable in IE7 (ie: you can right click and save as, or just view it in the browser directly), whereas the one which doesn't work at all is not accessible in any way, a 404 error is given if you try to access it directly and attempting to right click and save as gives a message saying "Internet Explorer cannot download style.php from www.routinefly.com. Internet Explorer was not able to access this internet site. The requested site is either unavailable or cannot be found. Please try again later.

    However you CAN save as and access the file in Firefox2, but it still doesn't render the CSS on the page

    I'm getting a little desperate here. I am 100% stumped as to what the problem is and not sure where to even start trying to fix the problem.

  7. #7
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,495
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'd start by looking at how the plugin is connecting with WordPress. Do you know if it's limited to a particular version of WordPress, or is it affecting every (current, as in 2.2.x, 2.3.x, and 2.5.x) version of WordPress?

  8. #8
    SitePoint Wizard ryanhellyer's Avatar
    Join Date
    Oct 2006
    Location
    New Zealand
    Posts
    2,323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dan Schulz View Post
    I'd start by looking at how the plugin is connecting with WordPress. Do you know if it's limited to a particular version of WordPress, or is it affecting every (current, as in 2.2.x, 2.3.x, and 2.5.x) version of WordPress?
    I've only heard reports from 2.5.x, but I've been assuming that shouldn't have any affect on the way the file is fed to the browser.

    Here's the style.php code in case that helps weed out the problem:
    Code:
    <?php
    require('../../../wp-blog-header.php');
    header('Content-type: text/css');
    
    echo '/*
      CSS generated via the Suckerfish WordPress Plugin ... http://ryanhellyer.net/2008/01/14/suckerfish-wordpress-plugin/
    
      If you would like a similar dropdown for your own site, then please contact Ryan Hellyer for
      information about getting your own custom designed dropdown menu ... http://ryanhellyer.net/contact/
    */
    
    ';
    echo get_option('suckerfish_css');
     ?>
    The header('Content-type: text/css'); code should (in theory) make it render as per a normal CSS file.

  9. #9
    SitePoint Wizard jimbo_dk's Avatar
    Join Date
    May 2005
    Location
    Singapore
    Posts
    1,261
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've had this problem before. Can't remember how I fixed it. Will dig into my notes and check it out. Have you tried clearing the headers first?

    What's happening is that before the CSS content is sent, a 404 error is being sent.
    Winners Respond. Losers React.
    Singapore Web Designer

  10. #10
    SitePoint Wizard ryanhellyer's Avatar
    Join Date
    Oct 2006
    Location
    New Zealand
    Posts
    2,323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I didn't know that I needed to clear the headers first. I'll try that tonight (am at work at the mo).

    Thanks for the help I'd almost given up hope of fixing it!

  11. #11
    SitePoint Wizard jimbo_dk's Avatar
    Join Date
    May 2005
    Location
    Singapore
    Posts
    1,261
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you tried removing the line
    Code:
    require('../../../wp-blog-header.php');
    Your PHP file is sending some extra headers. Here's a normal CSS file in your theme:
    Code:
    Date	Thu, 12 Jun 2008 07:09:30 GMT
    Server	Apache
    Last-Modified	Wed, 11 Jun 2008 20:16:52 GMT
    Etag	"1698e10-d82-485032b4"
    Accept-Ranges	bytes
    Content-Length	3458
    Content-Type	text/css
    Age	0
    And here's the file "style.php":
    Code:
    Date	Thu, 12 Jun 2008 07:07:20 GMT
    Server	Apache
    Cache-Control	no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    Expires	Thu, 19 Nov 1981 08:52:00 GMT
    Pragma	no-cache
    X-Pingback	http://www.routinefly.com/testing-grounds/xmlrpc.php
    Keep-Alive	timeout=15, max=100
    Connection	Keep-Alive
    Transfer-Encoding	chunked
    Content-Type	text/css
    Winners Respond. Losers React.
    Singapore Web Designer

  12. #12
    SitePoint Wizard ryanhellyer's Avatar
    Join Date
    Oct 2006
    Location
    New Zealand
    Posts
    2,323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Unfortunately I can't remove blog-header.php. I'm sure that is the problem, but it is a problem I need to work around as it is used to pull the data for the CSS from the WordPress database. Or perhaps there is another way to access that data?

    The response headers for a working style.php file are:
    Code:
    Date: Sun, 22 Jun 2008 08:27:59 GMT
    Server: Apache/1.3.41 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_ssl/2.8.31 OpenSSL/0.9.8g
    X-Pingback: http://pixopoint.com/demo/wordpress/xmlrpc.php
    X-Powered-By: PHP/5.2.6
    Keep-Alive: timeout=15, max=99
    Connection: Keep-Alive
    Transfer-Encoding: chunked
    Content-Type: text/css
    
    200 OK
    And for a malfunctioning one are:
    Code:
    Date: Sun, 22 Jun 2008 08:28:29 GMT
    Server: Apache
    Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    Pragma: no-cache
    X-Pingback: http://www.routinefly.com/testing-grounds/xmlrpc.php
    Keep-Alive: timeout=15, max=100
    Connection: Keep-Alive
    Transfer-Encoding: chunked
    Content-Type: text/css
    
    200 OK

    This seems more like a WordPress/PHP specific problem. So I'll try asking elsewhere unless someone here has a solution.


Bookmarks

Posting Permissions

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