Is there a better way to do this PHP code?
<p>My PHP site has header,body,footer files that are included into the INDEX.PHP page.<br />
 On the header.php file I have a menu like this</p>

<pre><code>    &lt;div id="bottomrow"&gt; 
      &lt;div class="pad"&gt; 
        &lt;ul class="menu left"&gt;
          &lt;li class="first &lt;?=$current_home?&gt;"&gt;&lt;a href="/"&gt;&lt;em&gt;Home&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
          &lt;li class="users drop &lt;?=$current_users?&gt;"&gt;&lt;a href=""&gt;&lt;em&gt;Users&lt;/em&gt;&lt;/a&gt;&lt;span class="drop"&gt;&amp;nbsp;&lt;/span&gt; 
        &lt;ul id="moreheader"&gt;
                &lt;li&gt;&lt;/li&gt;
                &lt;li&gt;&lt;/li&gt;

            &lt;/ul&gt;
       &lt;/li&gt;
          &lt;li class="&lt;?=$current_forum?&gt;"&gt;&lt;a href=""&gt;&lt;em&gt;Forums&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
          &lt;li class="drop &lt;?=$current_more?&gt;"&gt;&lt;a href="/moreheader"&gt;&lt;em&gt;More&lt;/em&gt;&lt;/a&gt;&lt;span class="drop"&gt;&amp;nbsp;&lt;/span&gt; 
            &lt;ul id="moreheader"&gt;
              &lt;li&gt;&lt;a href=""&gt;&lt;em&gt;Widgets&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=""&gt;&lt;em&gt;News&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=""&gt;&lt;em&gt;Promote&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=""&gt;&lt;em&gt;Development&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=""&gt;&lt;em&gt;Bookmarks&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=""&gt;&lt;em&gt;About&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
          &lt;/li&gt;
          &lt;li class="moneytabmenu &lt;?=$current_money?&gt;"&gt;&lt;a href="/moneytabmenu"&gt;&lt;em&gt;Money:&lt;span class="moneytabmenu-total"&gt;$0.00&lt;/span&gt;&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
        &lt;ul class="menu right"&gt;
          &lt;li class="drop myaccount &lt;?=$current_myaccount?&gt;"&gt;&lt;a href="" class="first"&gt;&lt;img class="avatar" src="http://gravatar.com/avatar.php?gravatar_id=7ab1baf18a91ab4055923c5fd01d68a2&amp;amp;rating=pg&amp;amp;size=80&amp;amp;default=" height="19" width="19" alt="you" /&gt;&lt;em&gt;My 
            Account&lt;/em&gt;&lt;/a&gt;&lt;span class="drop"&gt;&amp;nbsp;&lt;/span&gt; 
            &lt;ul id="myaccount"&gt;
              &lt;li&gt;&lt;a href=""&gt;&lt;em&gt;Dashboard&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=""&gt;&lt;em&gt;Account Settings&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=""&gt;&lt;em&gt;Settings&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
          &lt;/li&gt;
          &lt;li class="drop"&gt;&lt;a href=""&gt;&lt;em&gt;Mail&lt;/em&gt;&lt;/a&gt;&lt;span class="drop"&gt;&amp;nbsp;&lt;/span&gt; 
            &lt;ul id="mailboxheader"&gt;
              &lt;li&gt;&lt;a href=""&gt;&lt;em&gt;InBox&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=""&gt;&lt;em&gt;SentBox&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=""&gt;&lt;em&gt;Trash&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=""&gt;&lt;em&gt;Post Bulletin&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=""&gt;&lt;em&gt;View Bulletins&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
          &lt;/li&gt;
          &lt;li class="drop &lt;?=$current_more?&gt;"&gt;&lt;a href=""&gt;&lt;em&gt;More&lt;/em&gt;&lt;/a&gt;&lt;span class="drop"&gt;&amp;nbsp;&lt;/span&gt; 
            &lt;ul id="moreheader"&gt;
              &lt;li&gt;&lt;a href=""&gt;&lt;em&gt;Widgets&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=""&gt;&lt;em&gt;News&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=""&gt;&lt;em&gt;Promote&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=""&gt;&lt;em&gt;Development&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=""&gt;&lt;em&gt;Bookmarks&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=""&gt;&lt;em&gt;About&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
          &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;!-- END div#bottomrow --&gt;
  &lt;/div&gt;
</code></pre>

<p>The menu is similar to above, the above menu is not completed but you can see how it is set up, there are <li> list items that make up a menu and SOME of the list items have SUB-LIST items to make up sub-menus on some of the main menu items.  </p>

<p>If a user is on any of the pages in a sub-menu, it should add the "current" css class to the parent menu item.  </p>

<p>Below is my index.php page where I can determine which page I am on using $_GET for the variable index.php?p=PAGE-NAME</p>

<p>I posted a question earliar similar to this but it was before I did the code below and it didnt get much response, the response it did get all mentioned using arrays but that was beofre they new that I had sub-menus.</p>

<p><strong>So does anyone see a better way to add the css class "current" to a list item above based on which page I am on?</strong></p>

<p><hr /></p>

<p><strong>Code on INDEX.php page that processes which menu item should be highlighted</strong>  </p>

<pre><code>//set variables for menu item to appear as being SELECTED 
$p = $_GET['p'];

$current_home = '';
$current_users = '';
$current_forum = '';
$current_more = '';
$current_money = '';
$current_myaccount = '';
$current_mail = '';
//if home then highlight home menu
if($p === 'home'){
    $current_home = 'current';
}
if($p === 'users.online' || $p === 'users.location' || $p === 'users.featured' || $p === 'users.new' || $p === 'users.browse' || $p === 'users.search' $p === 'users.staff'){
    $current_users = 'current';
}
if($p === 'forum'){
    $current_forum = 'current';
}
if($p === 'widgets' || $p === 'news' || $p === 'promote' || $p === 'development' || $p === 'bookmarks'  || $p === 'about'){
    $current_more = 'current';
}
if($p === '=account.money' || $p === 'account.store' || $p === 'account.lottery' || $p === 'users.top.money'){
    $current_money = 'current';
}
if($p === 'account'){
    $current_myaccount = 'current';
}
if($p === 'mail.inbox' || $p === '=mail.sentbox' || $p === 'mail.trash' || $p === 'bulletins.post' || $p === 'bulletins.my'  || $p === 'bulletins'){
    $current_mail = 'current';
}
</code></pre>
