title: Navigation Bar, Relative Links
body: <p>i'm building a php cms style app for tracking of members characters, the projects coming along nicely, but I am wondering if there is a more efficient way of coding my navigation bar.</p>
  
  <p>the bar is included in many different pages so relative links as standard will not work for obvious reasons, the way I have been getting around this is by</p>
  
  <pre><code>if (strstr($_SERVER['SCRIPT_FILENAME'], "admin/char/")) {
  $home = "../../index.php";
  $logout = "../user/logout.php";
  } else if (strstr($_SERVER['SCRIPT_FILENAME'], "admin/user/")) {
  </code></pre>
  
  <p>etc.</p>
  
  <p>so I have each combination of path that could be typed, and this solution works, and quite well, but since I am copying pasting code and making changes the chances of me missing something is increased, and with more links this chance is increased.</p>
  
  <p>I am wondering if there a better way of achieving the same result with less code?</p>
  
  <p>Any advice would be greatly appreciated.</p>