Help - Search - Members - Calendar
Full Version: Basic PHP Include statement not working
Invision Power Services > Community Forums > Community Web Design and Coding
bradleyjx
Alright, I have a directory along the lines of:

/
/foo
/foo/bar/
/include

So, I want to write an include statement in a php code block in a site in /bar/ that points towards a site within /include/, so this is what I've been doing (highly simplified):

/include/page_a.php
CODE
<?php

     echo "this is the second page.";

?>


/foo/bar/page_b.php
CODE
<?php

     echo "this is the first page.";
     include ('../../include/page_a.php');

?>


Through trying many iterations of the include statement, I've found that my usage of "../" seems to not be working within the parameters of the site. In other words, if I setup the page_a.php to redirect such that the include would point to a folder "non" in the folder "bar", because I don't use the "../" it works fine. Is there something simple I'm missing, or is this something that's an issue in the way PHP was put onto this server?
Brendon Koz
I would personally assume that this is a problem with either PHP or the server itself. It's quite odd... Let us know if you find out what the problem is, as I'm somewhat curious as well.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.