Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    553
    Thanks
    0
    Thanked 0 Times in 0 Posts

    HREF to CSS Inconsistency, Performance?

    I have several subdirectories under one directory. That directory is two directories under the directory that holds my style sheet. If I code my href as in the first statement below, it works in one of the subdirectories, but not in the others, even though they are all immediate subdirectories of the same folder. A work around I used instead was to code the statement as shown in the second line below, with full url. Does coding the full url mean a performance impact?

    G

    echo"<HTML><HEAD><<LINK REL=\"stylesheet\" HREF=\"../../../basic2.css\" >";

    echo"<HTML><HEAD><LINK REL=\"stylesheet\" HREF=\"http://www.site.com/basic2.css\"> ";

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    echo"<HTML><HEAD><<LINK REL=\"stylesheet\" HREF=\"../../../basic2.css\" >";

    So the page the above is shown on is http://www.yoursite.com/one/two/three/page or
    http://www.yoursite.com/one/two/page ?

    If it's the first url, then the above css link should work

    If you're changing from one directory level to the ither, why not use this?

    Put this in a separate file and include the file on the top of every page
    PHP Code:
    $style 'http://www.yoursite.com/basic.css'
    And then use this as your style link
    PHP Code:
    echo '<html><head><link rel="stylesheet" href="'.$style.'">'
    Last edited by Nightfire; 10-13-2002 at 05:29 AM.

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    553
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Nightfire,

    All these subdirectories have the same immediate parent and the statement worked from one of them, but not the others. Shouldn't happen, but does... Yes, the url approach is fine. The only question I have is whether that approach involves any additional overhead.

    G

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    no overhead. but you can simplify it like this:

    echo"<HTML><HEAD><LINK REL=\"stylesheet\" HREF=\"/basic2.css\"> ";
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

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