Including a file from included file. Referencing issue
<p>Here's a sample file structure:</p>

<p>page.php <br/>
db.php <br/>
folder1/subpage.php <br/>
folder2/fn.php <br/></p>

<p>page.php</p>

<pre><code>require_once('folder2/fn.php');
</code></pre>

<p>folder1/subpage.php</p>

<pre><code>require_once('../folder2/fn.php');
</code></pre>

<p>folder2/fn.php - requires database connection</p>

<pre><code>require_once('../db.php');
/* then gets info from database */
</code></pre>

<p>Basically, fn.php contains database functions to get/set information. It requires db.php, which is database connection file. This code works in subpage.php, but not in page.php (getting "failed to open stream: No such file or directory in ..." error).</p>

<p>Is there a way (using relative referencing), so that it works in all files no matter of directory level?</p>

<p>Thanks for your help!</p>
