title: Dynamic Breadcrumbs in codeigniter
body: <p>P.S I'm a newbie in codeigniter and searched for answers but its far beyond my comprehension so I will ask this question for my level.</p>
  
  <p>I just found this code for a dynamic breadcrumb helper in youtube and I am receiving an error. Can you guys help me debug it? Cause I'm confuse with his code but its an efficient one cause you just simply echo the function in VIEW.
  This is the error:</p>
  
  <blockquote>
    <p>A PHP Error was encountered</p>
    
    <p>Severity: Parsing Error</p>
    
    <p>Message: syntax error, unexpected ';'</p>
    
    <p>Filename: helpers/breadcrumb_helper.php</p>
    
    <p>Line Number: 15</p>
    
    <p>Backtrace:</p>
  </blockquote>
  
  <p>Here is the code</p>
  
  <pre><code>    &lt;?php
  if(!function_exists('generatedBreadcrumb')){
      function generateBreadcrumb(){
          $ci=&amp;get_instance();
          $i=1;
          $iro = $ci-&gt;iri-&gt;segment($i);
          $link='
          &lt;div class="pageheader"&gt;
          &lt;h2&gt;&lt;i class="fa fa-edit"&gt;&lt;/i&gt;'.$ci-&gt;uri-&gt;segment($i).'&lt;/h2&gt;
          &lt;div class="breadcrumb-wrapper"&gt;
  
          &lt;ol class="breadcrumb"&gt;';
  
          while($uri != "){
          $prep_link = ";
          $for($j=1; $j&lt;=$i; $j++){
          $prep_link.=$ci-&gt;uri-&gt;segment($j).'/';
          }
  
          if($ci-&gt;uri-&gt;segment($i+1)=="){
              $link.='&lt;li class="active"&gt;&lt;a href=".site_uri($prep_link)."&gt;';
              $link.=$ci-&gt;uri-&gt;segment($i).'&lt;/a&gt;&lt;/li&gt;';
          }else{
              $link.='&lt;li&gt;&lt;a href=."site_url($prep_link)."&gt;';
              $link.=$ci-&gt;uri-&gt;segment($i).'&lt;/a&gt;&lt;span class="divider"&gt;&lt;/span&gt;&lt;/li&gt;';
          }
  
          $i++;
          $uri = $ci-&gt;uri-&gt;segment($i);
          }
          $link .='&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;';
          return $link;
          }
          }
  </code></pre>