title: Using CakePHP, how do you hide certain elements of a page from a user if they are logged in?
body: <p>How can I hide our main nav and use it as the home page but only for logged in users?</p>
  
  <p>The following is the code for the slideshow. The MENU is an element though. Should they both be in the element file together? Before I attempt to hide when logged in? File <code>/elements/nb_menu_home.ctp</code> reads:</p>
  
  <pre><code>&lt;script src="/js/loopedslider.js" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt;
  
  &lt;div id="loopedSlider"&gt;    &lt;!--Beginning of slideshow--&gt;
      &lt;div class="container"&gt;
          &lt;?php $session-&gt;flash(); ?&gt;
              &lt;div class="slides"&gt;
                  &lt;div id="slide_one" class="bg"&gt;&lt;!--slide #1--&gt;
                      &lt;div class="slide-content"&gt;
                          &lt;div class="nhome"&gt;
                              &lt;div class="nhhleft"&gt;
                                  Borrow a car for the weekend, textbooks, and other stuff you need from other students. Free or super cheap! &lt;br /&gt;
                                  Save money and resources @ USAFA.&lt;br /&gt;
                                  All users and transactions "Validated by REPIFY"   &lt;br /&gt;
                                  &lt;strong&gt;&lt;/strong&gt;
  
                                  &lt;br clear="all" /&gt;
                                  &lt;iframe src="http://www.facebook.com/plugins/like.php?href=www.neighborrow.com&amp;amp;layout=standard&amp;amp;show_faces=false&amp;amp;width=450&amp;amp;action=like&amp;amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height: 30px; text-align: center;margin-top: 20px;"&gt;&lt;/iframe&gt;
                                  &lt;br /&gt;
                                  &lt;?= $form-&gt;create('Item', array('action' =&gt; 'indextest')); ?&gt;
                              &lt;/div&gt;
  
                              &lt;div id="nhhright"&gt;
                                  &lt;img src="/images/items/cars.jpg" border="0" width="90" height="90"&gt;Cars&lt;a href="#more"&gt;View more&lt;/a&gt;
                                  &lt;br/&gt;
                                  &lt;img src="/images/items/games electronics.jpg" border="0" width="90" height="90"&gt;games electronics&lt;a href="#more"&gt;View more&lt;/a&gt;
                                  &lt;br/&gt;
                                  &lt;img src="/images/items/textbooks.jpg" border="0" width="90" height="90"&gt;textbooks&lt;a href="#more"&gt;View more&lt;/a&gt;
                                  &lt;img src="/images/items/gear.jpg" border="0" width="90" height="90"&gt;outdoor gear and uniforms&lt;a href="#more"&gt;View more&lt;/a&gt;
                              &lt;/div&gt;
  
                              &lt;div id="captureBlock"&gt;
                                  &lt;div id="index_headertop"&gt;&lt;text&gt;&lt;strong&gt;&lt;!--Request Item--&gt;&lt;/strong&gt;&lt;/text&gt;
                                      &lt;div id="index_close" onclick="divToggle('captureBlock');divToggle('fadedbg');"&gt;&lt;img src="/images/Index_close.jpg"&gt;
                                      &lt;/div&gt;
                                  &lt;/div&gt;
  
                                  &lt;div id="index_capturecontent"&gt;
                                      &lt;div id="index_logoheader"&gt;&lt;br/&gt;&lt;img src="/images/index_pupupheader.png"&gt;&lt;/div&gt;
                                      &lt;br/&gt;
  
                                      &lt;div id="indexinput_email"&gt;
                                              &lt;strong&gt;&lt;text&gt;Please Enter Your E-Mail To Continue&lt;/text&gt;&lt;/strong&gt;
                                              &lt;?= $form-&gt;input('User.emailindex', array('label' =&gt; ' ')); ?&gt;
                                              &lt;br/&gt;
                                              &lt;input type="image" src="/images/index_continue.jpg" /&gt;
                                      &lt;/div&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
  
                              &lt;!--  &lt;div id="index_searchblock"&gt;
                                        &lt;div id="index_search"&gt;
                                            &lt;?= $form-&gt;input('Item.itemindex',array('label'=&gt;'')); ?&gt;
                                            &lt;?= $form-&gt;end(); ?&gt;
  
                                            &lt;?= $form-&gt;create('user', array('action' =&gt; 'login')); ?&gt;
                                            &lt;?= $form-&gt;input('session.have',array('label'=&gt;''));?&gt;
                                        &lt;/div&gt;
  
                                        &lt;div id="index_listButton" style="cursor: pointer;"&gt;&lt;input type="image" src="/images/listbutton.png" /&gt;&lt;/div&gt;
                                        &lt;?= $form-&gt;end(); ?&gt;
                                        &lt;div id="index_requestButton" onclick="divToggle('captureBlock');divToggle('fadedbg');" style="cursor: pointer;"&gt;&lt;/div&gt;
                                    &lt;/div&gt;--&gt;
                          &lt;/div&gt;&lt;!-- capture block ends here --&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;&lt;!--end of slide #1--&gt;
  
                  &lt;div id="slide_two" class="bg"&gt;&lt;!--slide #2--&gt;
                      &lt;div class="slide-content"&gt;
                          &lt;div class="nhhleft"&gt;
                                  &lt;/a&gt;
                                 (1) Click on the item you want &lt;br /&gt;
                                    (2) Tell us when you want it&lt;br /&gt;
                                     (3) Provide your email address for confirmation and REPIFY&lt;br /&gt;
                                     (4) Use and return&lt;br /&gt;
                                 &lt;iframe src="http://www.facebook.com/plugins/like.php?href=www.neighborrow.com&amp;amp;layout=standard&amp;amp;show_faces=false&amp;amp;width=450&amp;amp;action=like&amp;amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height: 30px; text-align: center;margin-top: 20px;"&gt;&lt;/iframe&gt;
                                 &lt;br clear="all" /&gt;
                          &lt;/div&gt;
  
                          &lt;div id="nhhright"&gt;
                              &lt;br clear="all" /&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;&lt;!-- SLIDE CONTENT ENDS HERE--&gt;
                  &lt;/div&gt;&lt;!--end of slide #2--&gt;
  
                  &lt;div id="slide_three" class="bg"&gt;&lt;!--slide #3--&gt;
                      &lt;div class="slide-content"&gt;
                          &lt;div class="nhhleft"&gt;
                                &lt;br /&gt;&lt;br /&gt;SAVE Money, Time, Space, the Earth&lt;br/&gt;
                                MAKE Money, Friends, Space, a Difference
                                  &lt;br /&gt;&lt;br /&gt;
                                 &lt;iframe src="http://www.facebook.com/plugins/like.php?href=www.neighborrow.com&amp;amp;layout=standard&amp;amp;show_faces=false&amp;amp;width=450&amp;amp;action=like&amp;amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height: 30px; text-align: center;margin-top: 20px;"&gt;&lt;/iframe&gt;
                                 &lt;br clear="all" /&gt;
                          &lt;/div&gt;
                          &lt;div id="nhhright"&gt;
                              &lt;br clear="all" /&gt;
                              &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;
                              &lt;img src="/images/save.gif"&gt;&lt;br /&gt;&lt;img src="/images/make.gif"&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;&lt;!-- SLIDE CONTENT ENDS HERE--&gt;
                  &lt;/div&gt;&lt;!--end of slide #3--&gt;
  
                  &lt;div id="slide_four" class="bg"&gt;&lt;!--slide #4--&gt;
                      &lt;div class="slide-content"&gt;
                          &lt;div class="nhhleft"&gt;
                              USAFA!!!
                              &lt;br&gt;
                              If you want to bring us to another school &lt;?= $html-&gt;link('contact us', '/contact'); ?&gt;
                              &lt;br /&gt;&lt;br /&gt;
                              &lt;iframe src="http://www.facebook.com/plugins/like.php?href=www.neighborrow.com&amp;amp;layout=standard&amp;amp;show_faces=false&amp;amp;width=450&amp;amp;action=like&amp;amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height: 30px; text-align: center;margin-top: 20px;"&gt;&lt;/iframe&gt;
                                 &lt;br clear="all" /&gt;
                          &lt;/div&gt;
  
                          &lt;div id="nhhright"&gt;
                              &lt;img src="/images/skyline_3.jpg" /&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;&lt;!-- SLIDE CONTENT ENDS HERE--&gt;
                  &lt;/div&gt;&lt;!--end of slide #4--&gt;
  
                  &lt;div id="slide_five" class="bg"&gt;&lt;!--slide #5--&gt;
                      &lt;div class="slide-content"&gt;
                          &lt;div class="nhhleft"&gt;
                                 &lt;br /&gt;&lt;br /&gt;LOCAL AND NATIONAL MEDIA!&lt;br /&gt;
                                 &lt;iframe src="http://www.facebook.com/plugins/like.php?href=www.neighborrow.com&amp;amp;layout=standard&amp;amp;show_faces=false&amp;amp;width=450&amp;amp;action=like&amp;amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height: 30px; text-align: center;margin-top: 20px;"&gt;&lt;/iframe&gt;
                                 &lt;br clear="all" /&gt;
                          &lt;/div&gt;
  
                          &lt;div id="nhhright"&gt;
                              &lt;br clear="all" /&gt;
                                  &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;
                                  &lt;a href="http://www.myfoxny.com/dpp/good_day_ny/tech_it_out/091002_neighborrow_tech_it_out" target="_blank"&gt;&lt;img src="http://www.beta.neighborrow.com/images/nbmedia/fox.png" border="0" alt="Fox News" /&gt;&lt;/a&gt;
                                  &lt;a href="http://www.msnbc.msn.com/id/15484490/"&gt;&lt;img src="http://www.beta.neighborrow.com/images/nbmedia/msn.png" border="0" alt="MSNBC" /&gt;&lt;/a&gt;
                                  &lt;a href="http://www.thrillist.com/new-york/neighborrow"&gt;&lt;img src="http://www.beta.neighborrow.com/images/nbmedia/thrillist.png" border="0" alt="thrillist" /&gt;&lt;/a&gt;
                                  &lt;a href="http://online.wsj.com/article/SB121322069979265767.html?mod=RealEstateMain_1"&gt;&lt;img src="http://www.beta.neighborrow.com/images/nbmedia/wsj.png" border="0" alt="WSJ" /&gt;&lt;/a&gt;
                                  &lt;br/&gt;
                                  &lt;a href="http://www.msnbc.msn.com/id/21134540/vp/27160813#27160813"&gt;&lt;img src="http://www.beta.neighborrow.com/images/nbmedia/today.png" border="0" alt="Today" /&gt;&lt;/a&gt;
                                  &lt;a href="http://www.wnbc.com/news/16765259/detail.html"&gt;&lt;img src="http://www.beta.neighborrow.com/images/nbmedia/wnbc.png" border="0" alt="WNBC" /&gt;&lt;/a&gt;
                                  &lt;a href="http://159.54.226.237/08_issues/080601/080601thinksmart-vinegar-lighthouse-trade.html"&gt;&lt;img src="http://www.beta.neighborrow.com/images/nbmedia/usa.png" border="0" alt="USA" /&gt;&lt;/a&gt;
                                  &lt;a href="http://www.nydailynews.com/money/2008/07/08/2008-07-08_borrow_items_from_neighbors_through_new_.html"&gt;&lt;img src="http://www.beta.neighborrow.com/images/nbmedia/dailynews.png" border="0" alt="Daily News" /&gt;&lt;/a&gt;
                              &lt;/center&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;&lt;!-- SLIDE CONTENT ENDS HERE--&gt;
                  &lt;/div&gt;&lt;!--end of slide #5--&gt;
              &lt;/div&gt;
  
             &lt;?php print $this-&gt;element('nbmenu_home'); ?&gt;
         &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;script type="text/javascript" charset="utf-8"&gt;
          $(function(){
              $('#loopedSlider').loopedSlider({
                  });
          });
      &lt;/script&gt;
  </code></pre>