CodeIgniter Forums

Full Version: Extra characters / whitespace when loading view into variable
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Unknown[/eluser]
I'm trying to process a menu in the controller as follows:
Code:
/**
  * Renders the html output for the navigation items
  */
function _render_nav_items($current, $base_url) {

  $nav_items  = '';
  foreach($this->_get_nav_items() as $nav_item) {
   $nav_items .= $this->load->view(
    'admin/nav/nav_item',
    array(
     'nav_item' => $nav_item,
     'base_url' => $base_url
    ),
    true
   );
  }
  
  return $nav_items;
}

nav_item.php :
Code:
<li><a href="&lt;?=$base_url.$nav_item['controller']?&gt;">&lt;?=$nav_item['name']?&gt;</a></li>

But in the output I get the following output:
http://i.imgur.com/YMJ5kYU.png?2

Any ideas of why that is, I've tried running trim and compress on the output but I can't get those extra characters/whitespace removed from the output.