title: Dynamically Include Files From Different Folders
body: <p>I have the following script to do dynamic includes:</p>
  
  <pre><code> &lt;?php   
  $_GET["page"] = (isset($_GET["page"])) ? $_GET["page"] : "home";
  
      $page = $_GET['page'];
      $pages = array('home', 'solutions', 'projects', 'about', 'contact');
      if (!empty($page)) {
          if(in_array($page,$pages)) {
              $page .= '.php';
              include($page);
          }
          else {
          echo 'Page not found. Return to
          &lt;a href="index.php"&gt;index&lt;/a&gt;';
          }
      }
          else {
          include("home.php");
      }
         ?&gt;
  </code></pre>
  
  <p>What should I add to this script to be able to also include DYNAMICALLY files from different folders (e.g. I have an <code>index.php</code> page that is in the <code>www/mysite_folder</code> and I want to dynamically include  into the <code>index.php</code> the file <code>Adresses.php</code> that is in <code>www/mysite_folder/faq_folder</code>)? Note that by dynamic I don't mean the regular include (<code>include();</code>) but <code>&lt;a href="index.php?category=faq_folder&amp;page=adresses"&gt;Adresses&lt;/a&gt;</code>. </p>