title: Current URI Segment in CodeIgniter
body: <p>What would be the best way to check for the current URI segment in a CodeIgniter view?  What I am trying to do is use the current URI segment [i.e. $this->uri->segment(1)] in order to highlight the current page on the navigation bar.</p>
  
  <p>The best that I have figured out is to do</p>
  
  <pre><code>$data['current_uri'] = $this-&gt;uri-&gt;segment(1);
  $this-&gt;load-&gt;view('header', $data);
  </code></pre>
  
  <p>in each of my controllers and then in the header.php file, I check the $current_uri variable to determine which part of the navigation should be highlighted.  As you know, this is a very tedious way of doing it, but I'm at a loss of a better way to do this.</p>
  
  <p>It may even be possible to extend the default Controller class to pass the current URI segment, but I'm not sure if this would work, or even how to go about doing it.</p>