title: Relative Path issue while using PHP Include in subdirectories
body: <p>I am in the process of building a PHP application. The application itself has large number of pages and hence I decided to categorize each files into corresponding subdirectories.</p>
  
  <p>However I have encountered a problem. All the template resources folders(CSS, JS, Images, etc.) are located in the root folder <code>localhost/appname/</code>, and also the Navigation Menu (<code>navmenu.php</code>). I am including the menu in each page.</p>
  
  <p><strong>The problem arises when I try to include the <code>navmenu.php</code> inside the files in sub-directories.</strong></p>
  
  <p>For example, when I include <code>navmenu.php</code> in <code>index.php</code> (both in root folder), it works great. But when I include <code>navmenu.php</code> in addstudent.php located in the student subdirectory, all the <code>&lt;a href&gt;</code> links in navmenu.php become student/*.php (Relative Links)</p>
  
  <p>What is the proper way to solve such situations?</p>
  
  <p>I have a configuration file which is included in all PHP files. How should I create a constant, and how should I update the links in the <code>navmenu.php</code> href links?</p>