title: php: relative path in included files
body: <p>I have an html file images.html that shows images in subdirectory "img". It uses relative path to access the images in subdir.</p>
  
  <p>Everything goes wrong when in my index.php I do:</p>
  
  <pre><code>require_once("dir1/dir2/images.html");
  </code></pre>
  
  <p>Now the relative path is relative to my index.php, not to dir1/dir2/images.html and I can't see my images. Is there a way I can make the path relative to the <strong>included</strong> file images.html?</p>
  
  <p><strong>directory structure</strong></p>
  
  <pre><code>index.php
  dir1
     dir2
         images.html
         img
             flower.png
  </code></pre>
  
  <p><strong>index.php</strong></p>
  
  <pre><code>&lt;?php require_once("dir1/dir2/images.html"); ?&gt;
  </code></pre>
  
  <p><strong>images.html</strong></p>
  
  <pre><code>&lt;img src="img/flower.png" /&gt;
  </code></pre>