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

I'm trying to process a menu in the controller as follows:
  * 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(
     'nav_item' => $nav_item,
     'base_url' => $base_url
  return $nav_items;

nav_item.php :
<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:

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.