SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Addict
    Join Date
    Sep 2000
    Location
    Ontario, Canada
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    css doesn't work in NS 4.x

    I have a php script that dynamically creates css tags depending on the platform (mac/pc). Everything works perfectly in Netscape 6 and IE but it appears that older versions of NS don't even load the css file. The file is there, they just don't read it.

    The file is called like this:
    <link rel="stylesheet" href="/styles.php">
    And has tags like this <span class=standard>

    The file contains the content-type header:
    <?php
    header("content-type: text/plain");

    If I enter styles.php into the browser, everything looks ok - for example:

    .standard {
    font-family: verdana, arial;
    font-size: 10pt;
    color: #000000;
    }

    I can't find anything wrong with the coding but then again, I've been staring at it for hours now. So if anyone has any suggestions, please let me know.

    Thanks
    Jason Dulberg
    Extreme MTB
    http://extreme.nas.net

  2. #2
    PHP warrior dkode's Avatar
    Join Date
    Sep 2001
    Location
    Planet Namek
    Posts
    329
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i have a good suggestion:

    Netscape sucks!

    At work here, the other designers and myself don't usually call it netscape, we call it nutscrape crapigator. I hate it with a passion.

    Solution:

    Don't use it and tell people that go to your site with it, to get rid of it and install IE!
    "Mankind cannot define memory, yet it defines mankind"
    -- Project 2501, Ghost in the Shell

    Smarty | PEAR | PHP Manual | MySQL Manual

  3. #3
    SitePoint Addict
    Join Date
    Jul 2001
    Posts
    284
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Although it should not make any difference, try changing your css to look like...

    .standard {
    font : 10pt Verdana, Arial, sans-serif;
    color : #000000;
    }

    Netscape may also be having a problem with the extension type. It may require the css instead of php extension. I have no idea on this, so that is a pure guess as well.


  4. #4
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by dkode
    i have a good suggestion:

    Netscape sucks!

    At work here, the other designers and myself don't usually call it netscape, we call it nutscrape crapigator. I hate it with a passion.

    Solution:

    Don't use it and tell people that go to your site with it, to get rid of it and install IE!
    This is not a helpful suggestion. A valid question was asked, and whilst the points you raise about Netscape being a handful to code for are fair, your response was not useful as a solution.

    In future, please keep comments of this sort to the age-old "IE vs NS" threads.
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  5. #5
    blonde.... Sarah's Avatar
    Join Date
    Jul 2001
    Location
    Berkshire, UK
    Posts
    7,442
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    strange actually as I use css with tables and it works fine in NS 4.08 (although CSS2 doesn't) maybe it is that you need to have sytle.css not php. Have you tried maybe created a NS style sheet that can get loaded as a standard if you detect an old version of NS?

    hope its some help

    [edit - actually you might get a better response from the php forumn as that is where the php guys hang out and I am sure that they will ahve used css - I just use a standard css link so I am not much help]
    Regular user

  6. #6
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The CSS file should be called .css. There's no reason for it to be called PHP unless there is PHP code in the file, and there shouldn't be PHP code in a CSS file anyway. It's always best to stick to standard practices, especially when they're part of the W3C spec.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  7. #7
    SitePoint Enthusiast
    Join Date
    Oct 2001
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ns4 is very literal when it comes to style. Try putting the full url for your style sheet. http://www.whatever
    same for any images you have, the full url.

    another style tip for ns4 is dont use inline styles, and classes come before your IDs in the style sheet.

    stevo

  8. #8
    SitePoint Addict
    Join Date
    Sep 2000
    Location
    Ontario, Canada
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for all of your responses. I have found the problem. Creole mentioned that the file must be called .css and that worked out. Since I have php code inside the script, I had to use a .htaccess file to force the parsing of php inside the css file. So the .htaccess looks like

    <Files styles.css>
    ForceType application/x-httpd-php
    </Files>

    Simple and effective.

    Thank you all again for your input!
    Jason Dulberg
    Extreme MTB
    http://extreme.nas.net

  9. #9
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    WHOAH there...that't NOT a good idea.

    If you really want to use PHP inside your stylseheet file, then drop the LINK REL tag and simply use PHP's include() function.

    Don't change the handling of a file simply because it doesn't work the way you want to. It's better to find a way to do it within normal usage first. If that doesn't work THEN you can step outside.

    You're just making things harder for yourself that way.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes


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
  •