I am fairly new to PHP, I can some simply things. I am trying to place an echo:

<?php echo $getPath; ?>

inside of an include

<?php include("INSET HERE/menu/about.php"); ?> 

and have had no results. Either the page shows blank or the include doesn't show.

    Do you mean something like this?

    include($getPath . '/menu/about.php');
    

      that was my first thought also but it doesn't show the include. Just so I know we're on the same page here is the whole PHP.

      <?php include($getPath . '/menu/about.php'); ?>

      I wouldn't think that a server setting would effect this. Any ideas?

        Do some debugging:

        <?php
        ini_set('display_errors', true);
        error_reporting(E_ALL);
        $includeFile = $getPath . '/menu/about.php';
        if(!file_exists($includeFile)) {
           user_error("Could not find include file '$includeFile'");
        }
        if(!is_readable($includeFile)) {
           user_error("'$includeFile' is not readable");
        }
        else {
           include $includeFile;
        }
        

          I do know that individually both my include and echo work. I just do know why they don't want to work together.

            Kevin01;10980428 wrote:

            Do I drop this into my page as is?

            Either put it in your script replacing the include line in question, or just run as a separate script -- but you'll need to add whatever code you use to define the path variable it uses.

              I used your code and it kicks back an error that the file can't be found at the URL specified, http://www.domainname/menu/about.php. Which is really funny because I can go directly to the include in a browser using the URL in the error.

              It seems this code is returning the correct URL for the include but for some reason doesn't display.

              <?php include($getPath . 'menu/about.php'); ?>

              Note, I took out the / in front of menu because it is in $getPath

                I loaded a phpinfo to check PHP settings and I found allow_url_include is off. Could this be causing the problem?

                  The problem (IMHO) is that you are trying to include things via a URL.

                  Why not just include the file via the local file system instead?

                    Write a Reply...