SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,438
    Mentioned
    82 Post(s)
    Tagged
    3 Thread(s)

    Using incudes folder breaking navigation

    I have made a rod for my own back here as I have put some of my files ( header, footer, navigation, sidebar ) in a includes folder that is specified in php.ini

    If I am working in the root folder everything works OK with this navigation file inside the includes folder:
    PHP Code:
    <?php

    //$address = 'www.rubblewebs.co.uk/imagemagick/';
    $address '';

    $address_im =  'imagemagick/';

        echo
        
    "<div id=\"navcontainer\">
     <ul id=\"navlist\">
     <li id=\"active\"><a class=\"list\" href=\""
    .$address."index.php\" alt=\"Back to the main website\" title=\"Back to the main website\">Rubblewebs</a></li>
     <li><a class=\"list\" href=\""
    .$address."cont.php\" alt=\"Contact me\" title=\"Contact me\">Contact</a></li>
     <li><a class=\"list\" href=\""
    .$address."websites.php\" alt=\"Websites by Rubblewebs\" title=\"Websites by Rubblewebs\" >Websites</a></li>
     <li><a class=\"list\" href=\""
    .$address_im."index.php\" alt=\"Imagemagick index page\" title=\"Imagemagick index page\" >Imagemagick index page</a></li>
     <li><a class=\"list\" href=\""
    .$address_im."operators.php\" alt=\"List of operators\" title=\"List of operators\" >Imagemagick operators</a></li>
     <li><a class=\"list\" href=\""
    .$address_im."snippets/index.php\" alt=\"More examples of how to use IM\" title=\"More examples of how to use IM\">Imagemagick snippets</a></li>
     </ul>
     </div>"
    ;

     
    ?>
    I am sure I the $address variables are the problem as if I start from a folder inside root for example /imagemagick and try to go to the the contact page I have something like http :// www .rubblewebs.co.uk/imagemagick/cont.php but cont.php is not in the imagemagick folder. ( spaces addd to the url to try and stop a link here ).
    I also have a problem with my css file and header image - I had to give them the full path including the http: etc.
    Can somebody please point me in the correct direction to go to correct this problem.

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,331
    Mentioned
    463 Post(s)
    Tagged
    8 Thread(s)
    This is all much easier if you use root-relative urls, as they work the same from anywhere in the site.

    Code:
    <a href="/imagemagic/snipppets/">

  3. #3
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,438
    Mentioned
    82 Post(s)
    Tagged
    3 Thread(s)
    As easy as that Ralph - I was looking for something more complicated!

    Thanks


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
  •