title: how to display controller array values in mvc concept?
body: <p>Undefined variable category and Undefined variable i. error occurs .I cannot display array values from controller,so please help me how to solve this error
   This my header.php controller file:</p>
  
  <pre><code>            &lt;?php
          class ControllerCommonHeader extends Controller {
              public function index() {
                  $data['title'] = $this-&gt;document-&gt;getTitle();
  
                  if ($this-&gt;request-&gt;server['HTTPS']) {
                      $server = $this-&gt;config-&gt;get('config_ssl');
                  } else {
                      $server = $this-&gt;config-&gt;get('config_url');
                  }
  
                  $data['base'] = $server;
                  $data['description'] = $this-&gt;document-&gt;getDescription();
                  $data['keywords'] = $this-&gt;document-&gt;getKeywords();
                  $data['links'] = $this-&gt;document-&gt;getLinks();
                  $data['styles'] = $this-&gt;document-&gt;getStyles();
                  $data['scripts'] = $this-&gt;document-&gt;getScripts();
                  $data['lang'] = $this-&gt;language-&gt;get('code');
                  $data['direction'] = $this-&gt;language-&gt;get('direction');
  
                  if ($this-&gt;config-&gt;get('config_google_analytics_status')) {
                      $data['google_analytics'] = html_entity_decode($this-&gt;config-&gt;get('config_google_analytics'), ENT_QUOTES, 'UTF-8');
                  } else {
                      $data['google_analytics'] = '';
                  }
  
                  $data['name'] = $this-&gt;config-&gt;get('config_name');
  
                  if (is_file(DIR_IMAGE . $this-&gt;config-&gt;get('config_icon'))) {
                      $data['icon'] = $server . 'image/' . $this-&gt;config-&gt;get('config_icon');
                  } else {
                      $data['icon'] = '';
                  }
  
                  if (is_file(DIR_IMAGE . $this-&gt;config-&gt;get('config_logo'))) {
                      $data['logo'] = $server . 'image/' . $this-&gt;config-&gt;get('config_logo');
                  } else {
                      $data['logo'] = '';
                  }
  
                  $this-&gt;load-&gt;language('common/header');
  
                  $data['text_home'] = $this-&gt;language-&gt;get('text_home');
                  $data['text_wishlist'] = sprintf($this-&gt;language-&gt;get('text_wishlist'), (isset($this-&gt;session-&gt;data['wishlist']) ? count($this-&gt;session-&gt;data['wishlist']) : 0));
                  $data['text_shopping_cart'] = $this-&gt;language-&gt;get('text_shopping_cart');
                  $data['text_logged'] = sprintf($this-&gt;language-&gt;get('text_logged'), $this-&gt;url-&gt;link('account/account', '', 'SSL'), $this-&gt;customer-&gt;getFirstName(), $this-&gt;url-&gt;link('account/logout', '', 'SSL'));
  
                  $data['text_account'] = $this-&gt;language-&gt;get('text_account');
                  $data['text_register'] = $this-&gt;language-&gt;get('text_register');
                  $data['text_login'] = $this-&gt;language-&gt;get('text_login');
                  $data['text_order'] = $this-&gt;language-&gt;get('text_order');
                  $data['text_transaction'] = $this-&gt;language-&gt;get('text_transaction');
                  $data['text_download'] = $this-&gt;language-&gt;get('text_download');
                  $data['text_logout'] = $this-&gt;language-&gt;get('text_logout');
                  $data['text_checkout'] = $this-&gt;language-&gt;get('text_checkout');
                  $data['text_category'] = $this-&gt;language-&gt;get('text_category');
                  $data['text_all'] = $this-&gt;language-&gt;get('text_all');
  
                  $data['home'] = $this-&gt;url-&gt;link('common/home');
                  $data['wishlist'] = $this-&gt;url-&gt;link('account/wishlist', '', 'SSL');
                  $data['logged'] = $this-&gt;customer-&gt;isLogged();
                  $data['account'] = $this-&gt;url-&gt;link('account/account', '', 'SSL');
                  $data['register'] = $this-&gt;url-&gt;link('account/register', '', 'SSL');
                  $data['login'] = $this-&gt;url-&gt;link('account/login', '', 'SSL');
                  $data['order'] = $this-&gt;url-&gt;link('account/order', '', 'SSL');
                  $data['transaction'] = $this-&gt;url-&gt;link('account/transaction', '', 'SSL');
                  $data['download'] = $this-&gt;url-&gt;link('account/download', '', 'SSL');
                  $data['logout'] = $this-&gt;url-&gt;link('account/logout', '', 'SSL');
                  $data['shopping_cart'] = $this-&gt;url-&gt;link('checkout/cart');
                  $data['checkout'] = $this-&gt;url-&gt;link('checkout/checkout', '', 'SSL');
                  $data['contact'] = $this-&gt;url-&gt;link('information/contact');
                  $data['telephone'] = $this-&gt;config-&gt;get('config_telephone');
  
                  $status = true;
  
                  if (isset($this-&gt;request-&gt;server['HTTP_USER_AGENT'])) {
                      $robots = explode("\n", str_replace(array("\r\n", "\r"), "\n", trim($this-&gt;config-&gt;get('config_robots'))));
  
                      foreach ($robots as $robot) {
                          if ($robot &amp;&amp; strpos($this-&gt;request-&gt;server['HTTP_USER_AGENT'], trim($robot)) !== false) {
                              $status = false;
  
                              break;
                          }
                      }
                  }
  
  
          $this-&gt;load-&gt;model('catalog/manufacturer');
          $data['categories'] = array();
  
          $results = $this-&gt;model_catalog_manufacturer-&gt;getManufacturers(); //here getting manufacturer values from database.
  
          foreach ($results as $result) {
              if (is_numeric(utf8_substr($result['name'], 0, 1))) {
                  $key = '0 - 9';
              } else {
                  $key = utf8_substr(utf8_strtoupper($result['name']), 0, 1);
              }
  
              if (!isset($data['categories'][$key])) {
                  $data['categories'][$key]['name'] = $key;
              }
  
          $data['categories'][$key]['manufacturer'][] = array( //i can't able to display this array values
                  'name' =&gt; $result['name'],
                  'href' =&gt; $this-&gt;url-&gt;link('product/manufacturer/info', 'manufacturer_id=' . $result['manufacturer_id'])
              );
          }
                  // Menu
                  $this-&gt;load-&gt;model('catalog/category');
  
                  $this-&gt;load-&gt;model('catalog/product');
  
                  $data['categories'] = array();
  
                  $categories = $this-&gt;model_catalog_category-&gt;getCategories(0);
  
                  foreach ($categories as $category) {
                      if ($category['top']) {
                          // Level 2
                          $children_data = array();
  
                          $children = $this-&gt;model_catalog_category-&gt;getCategories($category['category_id']);
  
                          foreach ($children as $child) {
                              $filter_data = array(
                                  'filter_category_id'  =&gt; $child['category_id'],
                                  'filter_sub_category' =&gt; true
                              );
  
                              $children_data[] = array(
                                  'name'  =&gt; $child['name'] . ($this-&gt;config-&gt;get('config_product_count') ? ' (' . $this-&gt;model_catalog_product-&gt;getTotalProducts($filter_data) . ')' : ''),
                                  'href'  =&gt; $this-&gt;url-&gt;link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])
                              );
                          }
  
                          // Level 1
                          $data['categories'][] = array(
                              'name'     =&gt; $category['name'],
                              'children' =&gt; $children_data,
                              'column'   =&gt; $category['column'] ? $category['column'] : 1,
                              'href'     =&gt; $this-&gt;url-&gt;link('product/category', 'path=' . $category['category_id'])
                          );
                      }
                  }
  
                  $data['language'] = $this-&gt;load-&gt;controller('common/language');
                  $data['currency'] = $this-&gt;load-&gt;controller('common/currency');
                  $data['search'] = $this-&gt;load-&gt;controller('common/search');
                  $data['cart'] = $this-&gt;load-&gt;controller('common/cart');
  
                  // For page specific css
                  if (isset($this-&gt;request-&gt;get['route'])) {
                      if (isset($this-&gt;request-&gt;get['product_id'])) {
                          $class = '-' . $this-&gt;request-&gt;get['product_id'];
                      } elseif (isset($this-&gt;request-&gt;get['path'])) {
                          $class = '-' . $this-&gt;request-&gt;get['path'];
                      } elseif (isset($this-&gt;request-&gt;get['manufacturer_id'])) {
                          $class = '-' . $this-&gt;request-&gt;get['manufacturer_id'];
                      } else {
                          $class = '';
                      }
  
                      $data['class'] = str_replace('/', '-', $this-&gt;request-&gt;get['route']) . $class;
                  } else {
                      $data['class'] = 'common-home';
                  }
  
                  if (file_exists(DIR_TEMPLATE . $this-&gt;config-&gt;get('config_template') . '/template/common/header.tpl')) {
                      return $this-&gt;load-&gt;view($this-&gt;config-&gt;get('config_template') . '/template/common/header.tpl', $data);
                  } else {
                      return $this-&gt;load-&gt;view('default/template/common/header.tpl', $data);
                  }
              }
          }
  </code></pre>
  
  <p>And this my html code:</p>
  
  <pre><code>&lt;li&gt;&lt;a href="&lt;?php echo $category['manufacturer'][$i]['href']; ?&gt;"&gt;&lt;?php echo $category['manufacturer'][$i]['name']; ?&gt;&lt;/a&gt;&lt;/li&gt;
  </code></pre>