title: A way to include paths dynamically in php?
body: <p>I have structured a server with this file and folders:</p>
  
  <pre><code>index.php
  |lib -&gt; lib.php
  |framework -&gt; fw.php
  |folderA -&gt; index2.php
  </code></pre>
  
  <p>In lib.php there is functionA() with a require_once inside that calls "fw.php" correctly from index2.php:</p>
  
  <pre><code>functionA(){
      require_once "../framework/fw.php";
      //other stuff... 
  }
  </code></pre>
  
  <p>if it's called from index.php, the path must be changed.
  I really need a method to include paths dynamically without setting up a specific code inside every page.</p>
  
  <p>Does exist a method to fix the path?</p>
  
  <p>I tried to use __FILE__, dirname()...but without a satisfied solution.</p>