PHP - Can I nest includes?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Ok.  Can I include a PHP file from a file that has been included.
From the example below, I have a start PHP page with an include to a
type of template page, and from page 2, I include a 3rd page.  The
first include works, but the page 3 is brought in as standard text.
Is this a PHP limitation, or do I need to make a change to the PHP
config. file?



<? include("page2.php"); ?>



<title>Sans Titre</title>
<meta http-equiv="content-type" content="text/html;
charset=iso-8859-1" />
<meta name="generator" content="HAPedit 3.1">
<body bgcolor="#FFFFFF">
  // Your code here
  echo "<hr />\n".
       "HAPedit (September 2005 7:03:30 PM)<p>";



$x = 100;
echo $x." This is a test";

Re: PHP - Can I nest includes?

David wrote:
Quoted text here. Click to load it


Well, I am surprised anything is including at all...  Take a look:

Quoted text here. Click to load it

First of all, it it not requires(), but require().  Second, your
require() statements is outside of any PHP block and inside an
HTML block; it shouldn't have been executed at all...  


Site Timeline