title: PHP easier way to hide/show menu items to logged in / logged out users
body: <p>Is there an easier more efficient way to hide/show menu items to logged in, logged out users? It seems like I should not have to copy the whole menu again with duplicate menu items. The menu items maybe in different order like below</p>
  
  <p>You can see in my example below I have added to links in the <code>&lt;?php } else { ?&gt;</code> statement</p>
  
  <pre><code>&lt;?php
      if($_SESSION["loggedIn"] == "yes") { 
      ?&gt;
      &lt;ul class="nav navbar-nav"&gt;
        &lt;li class="active"&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="retailers.php"&gt;Stores&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="coupons.php"&gt;Coupons&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="featured.php"&gt;Featured Offers&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="howitworks.php"&gt;How It Works&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="help.php"&gt;Help&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
  
      &lt;?php } else { ?&gt;
          &lt;ul class="nav navbar-nav"&gt;
            &lt;li class="active"&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="retailers.php"&gt;Stores&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="coupons.php"&gt;Coupons&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="myaccount.php"&gt;My Account&lt;/a&gt;&lt;/li&gt;//logged in item
            &lt;li&gt;&lt;a href="featured.php"&gt;Featured Offers&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="howitworks.php"&gt;How It Works&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="help.php"&gt;Help&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="myfavorites.php"&gt;My Favorite Stores&lt;/a&gt;&lt;/li&gt;//logged in item
          &lt;/ul&gt;
      &lt;?php
      }
  ?&gt;
  </code></pre>