title: How do I load content from a PHP file (and executing the script) from another PHP file?
body: <p>I have a PHP script (index.php) that changes the page shown depending on the query part of the URL (using GET). All the links in the page access different "pages" using <code>?page=pageName</code> and the index.php script loads HTML from text files accordingly (echoing it to the screen).</p>
  
  <p>So, if a user goes to <code>index.php?page=about</code>, my PHP script loads a file called <code>about.php</code> and echoes it in a view container in the browser.</p>
  
  <p><strong>However, I have a big problem</strong>: The content I'm loading has PHP scripts inside it, but those scripts aren't executed when echoed using the <code>index.php</code> script. That makes it impossible for me to load a page that contains, say, a directory listing pulled from a MySQL database.</p>
  
  <p>So basically, I want to know if there is any way that I can echo a PHP file onto a page but execute the PHP code inside the file as well.</p>
  
  <p>For clarity, I have attached an annotated screenshot that describes what I mean:</p>
  
  <p><strong>EDIT:</strong> Here's the link:</p>
  
  <p><img src="https://i.stack.imgur.com/fV3gt.jpg" alt="enter image description here"></p>