PHP mess

Discussion in 'Software' started by jratcliffe, Oct 16, 2009.

  1. jratcliffe

    jratcliffe Private E-2

    hi just trying to pick up a site already made (not by me) and add more content to it but when i try i get this php include error ideas?

    you can see the error here http://www.carnivalproperties.co.uk/location/albufeira/index.php (page is isolated so this a directed link)

    tried
    <?php include("htdocs/inc/primarynav.php"); ?>
    <?php include("../inc/primarynav.php"); ?>
    <?php include("inc/primarynav.php"); ?>
     
  2. JJJIrish05

    JJJIrish05 Sergeant

    I usually use <?php include_once("./blahblah.php"); ?>

    Did you check to see if the file you're including has includes inside of it that might be making these errors?
     
  3. jratcliffe

    jratcliffe Private E-2

    yea the files are being accessed by the rest of the website pages :s just not this one not heard of <?php include_once("./blahblah.php"); ?>
    but tried it still failed :( starting to tear hair out over this now...
     
  4. pclover

    pclover MajorGeek

    Where is index.php and primarynav.php located.
     
  5. notageek_honest

    notageek_honest Private E-2

    There is such a simple answer to this question it is untrue.
    All you need to do is reference the files correctly.
    You are using a web page that is two directories deep. But when you are trying to reference the files you require you are only going back one directory. So instead of looking in the root directory for the “inc” directory you are looking in the “location” folder.
    To reference the files correctly you need to have
    <code>
    <?php
    Include(‘../../inc/baseurl.php’);
    ?>
    </code>
    That will then take it back upto the root directory and start navigating from there. It takes it back to basic directory navigation in the days of DOS.
     
  6. jratcliffe

    jratcliffe Private E-2

    Duh ! thanks totaly forget cos it in new folder it would be a dir down thanks ! *kicks self for being so stupid. works now :D
     
  7. SWario

    SWario Sergeant

    Actually, if the server is running Linux, doing:
    Code:
    include ("/inc/basurl.php");
    
    Should also work because the first "/" represents the root directory unless preceded by a period. Unless the root directory that jratcliffe sees is not the REAL root directory of the server.

    For anyone who doesn't already know: note that "../" means "go up one directory from the file I'm in now" while "./" means "in the same directory as the file I'm in now". In the case of the example given by notageek, "../../" means "go up two directories from the file I'm in now".
     
  8. jratcliffe

    jratcliffe Private E-2

    true the site currently on a fast host hosting solution so prob not seeing the root dir planning on moving it
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds