Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 9 of 9
  1. #1
    Member banj's Avatar
    Join Date
    Jan 2008
    Posts
    42
    Member #
    16378
    Hi all,

    Might seem like an easy one. :disagree: But here goes...

    Having trouble with folder roots using PHP header.

    For instance. PHP header (header.php) is in the root directory.

    Then I have a sub folder, say root>news>2012 within here are the news articles (article.php or exactly: news/2012/article.php)

    However, when I link back to ../../header.php all works fine (with CSS etc) but then when I try to click on a menu button - say 'aboutus.php' the link will try to go to news/2012/aboutus.php when this doesn't exist as its in the root folder!!!

    Any advice on how to navigate back to the pages within the root?

    Cheers,
    banj

  2.  

  3. #2
    WDF Staff AlphaMare's Avatar
    Join Date
    Oct 2009
    Location
    Montreal, Canada
    Posts
    4,570
    Member #
    20277
    Liked
    878 times
    The problem is that your links in your menu are trying to point to a page inside whatever folder you are currently in (the subfolder). So you'll have to make your menu links in your header.php be absolute links (http:// www . about-us . php) - that way the browser will know they are in the root and not look for them in the sub folder.
    Good design should never say "Look at me!"
    It should say "Look at this." ~ David Craib


    http://digitalinsite.ca ~ my current site . . info@digitalinsite.ca ~ my email

    If you feel that someone's post helped you fix your problem, answered your question, or just made you feel better, feel free to "Like" their post. The "Like" link is at the bottom right of each post, along side the "reply" link. And if you are being helped here, try to help someone else - pass it on!

  4. #3
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,716
    Member #
    5580
    Liked
    718 times
    Give us a link to your site.
    I'm wondering if there's a better way for you to organize it.


  5. #4
    Member banj's Avatar
    Join Date
    Jan 2008
    Posts
    42
    Member #
    16378
    Hi, the thing is about "giving a link" is that the site is totally off websites - i.e. its used mainly for private clients for an organisation I work for. I have the robots disallow search engines .txt in the website root to disallow the majority of public seeing the site therefore the senior management don't allow posting links.

    However, currently site root looks like this:

    Folders:
    access-area (cpanel controlled password-protected area)
    css (css info)
    documents (docs)
    images
    js (javascript)

    Pages:
    all php pages remain in the root approx 50 pages (inc news)
    about.php
    clients.php
    contact.php
    etc etc etc

    Thats why I enquired about the header not corresponding to the menu links - to find a better way to organise the website into relevant folders.

  6. #5
    Member banj's Avatar
    Join Date
    Jan 2008
    Posts
    42
    Member #
    16378
    Thanks AlphaMare!!

    I will give this a shot and let you know how I go.

  7. #6
    Member banj's Avatar
    Join Date
    Jan 2008
    Posts
    42
    Member #
    16378
    Also,

    I do notice that many sites use php, but their pages don't end in php.

    Example:

    aboutus.php url looks like http://www.companyname/aboutus and not http://www.companyname/aboutus.php

    I wonder how this is achieved?

  8. #7
    Senior Member Webzarus's Avatar
    Join Date
    May 2011
    Location
    South Carolina Coast
    Posts
    3,322
    Member #
    27709
    Liked
    770 times
    Apache mod rewrite using .htaccess rules

  9. #8
    Member banj's Avatar
    Join Date
    Jan 2008
    Posts
    42
    Member #
    16378
    AlphaMare, this has worked perfectly, thanks for your advice.

    Webzarus, thanks for your tip. I will try to incorporate what you have said. Thanks.

  10. #9
    WDF Staff AlphaMare's Avatar
    Join Date
    Oct 2009
    Location
    Montreal, Canada
    Posts
    4,570
    Member #
    20277
    Liked
    878 times
    Quote Originally Posted by banj, post: 232888
    AlphaMare, this has worked perfectly, thanks for your advice.

    Webzarus, thanks for your tip. I will try to incorporate what you have said. Thanks.
    You're welcome! It's always nice to know something I said helped!
    Good design should never say "Look at me!"
    It should say "Look at this." ~ David Craib


    http://digitalinsite.ca ~ my current site . . info@digitalinsite.ca ~ my email

    If you feel that someone's post helped you fix your problem, answered your question, or just made you feel better, feel free to "Like" their post. The "Like" link is at the bottom right of each post, along side the "reply" link. And if you are being helped here, try to help someone else - pass it on!


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:24 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com