title: How to set Parent and Sub-menu class as active
body: <p>Current Issue: Getting Parent and Sub-menu class as active.</p>
  
  <p>Bassically, I have a json array with my current page layout. I want to cycle through the array and find if it matches with the current page. For some reason it simply does not match and when I do get it to match it outputs the page name not "active" or "_active" ?</p>
  
  <p>Any better ways of doing this would be much appreciated :)</p>
  
  <p>json page array:</p>
  
  <pre><code>{
      "Pages":{
          "Home":"Dashboard",
          "USD Market":{
              "Current-Trades":"USD-Current-Trades",
              "Exchange-Trades":"USD-Exchange-Trades"
          }
      }
  }
  </code></pre>
  
  <p>in page header:</p>
  
  <pre><code>&lt;?php   
      $directoryURI = $_SERVER['REQUEST_URI'];
      $path = parse_url($directoryURI, PHP_URL_PATH);
      $components = explode('/', $path);
      $pagename = $components[1];
  ?&gt;
  </code></pre>
  
  <p>function:</p>
  
  <pre><code>    public function pages($pagename)
  {
      if ($pagename == array($config['Pages']))
      {
          print 'yes';
      } else {
          print 'no';
      }
  }
  </code></pre>
  
  <p>Menu:</p>
  
  <pre><code>            &lt;div class="menu"&gt;
              &lt;ul class="list"&gt;
                  &lt;li class="header"&gt;MAIN NAVIGATION&lt;/li&gt;
                  &lt;li class="&lt;?php print $dash-&gt;pages($pagename); ?&gt;"&gt;
                      &lt;a href="/Dashboard"&gt;
                          &lt;i class="material-icons"&gt;home&lt;/i&gt;
                          &lt;span&gt;Home&lt;/span&gt;
                      &lt;/a&gt;
                  &lt;/li&gt;
                  &lt;li&gt;
                      &lt;a href="javascript:void(0);" class="menu-toggle"&gt;
                          &lt;i class="material-icons"&gt;trending_down&lt;/i&gt;
                          &lt;span&gt;USD ($) - Market Trades&lt;/span&gt;
                      &lt;/a&gt;
                      &lt;ul class="ml-menu"&gt;
                          &lt;li class="&lt;?php print $dash-&gt;pages($pagename); ?&gt;"&gt;
                              &lt;a href="/USD-Current-Trades"&gt;
                                  &lt;span&gt;Current Trades&lt;/span&gt;
                              &lt;/a&gt;
                          &lt;/li&gt;
                          &lt;li&gt;
                              &lt;a href="javascript:void(0);"&gt;
                                  &lt;span&gt;Exchange Trades&lt;/span&gt;
                              &lt;/a&gt;
                          &lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/li&gt;
              &lt;/ul&gt;
          &lt;/div&gt;
  </code></pre>
  
  <p>Thank you for any input provided :)</p>