Cmenu Widget Visibility Of Entire Menu?

Hi -

I wanted to have a second row of links that are only visible to logged in users. I added a second CMenu widget and the row showed up. I need to fiddle with the css eventually, but for now the buttons are here - cool! However I haven’t been able to figure how to make the whole second menu invisible to non-logged in clients.


       <div id="mainmenu">

                <?php $this->widget('zii.widgets.CMenu',array(

                        'items'=>array(

                                array('label'=>'Home', 'url'=>array('/site/index')),

                                array('label'=>'About', 'url'=>array('/site/page', 'view'=>'about')),

                                array('label'=>'Contact', 'url'=>array('/site/contact')),

                                array('label'=>'Login', 'url'=>array('/site/login'), 'visible'=>Yii::app()->user->isGuest),

                                array('label'=>'Logout ('.Yii::app()->user->name.')', 'url'=>array('/site/logout'), 'visible'=>!Yii::app()->user->isGuest)

                        ),

                )); ?>


                <?php

                    # This is the second menu

                    $this->widget('zii.widgets.CMenu',array(

                        'items'=>array(

                                array('label'=>'Orders', 'url'=>array('/orders')),

                                array('label'=>'About', 'url'=>array('/site/page', 'view'=>'about')),

                        ),

# did not work so commented out #  array ( 'visible'=>!Yii::app()->user->isGuest ),

                )); ?>


        </div><!-- mainmenu -->



I guess the proper solution would be to make every item conditionally visible? Or is there a way to conditionally show blocks of html based on "Yii::app()->user->isGuest"?

thank you very much,

Joe

And (of course!) five minutes after I post my question, the answer comes to me:




                <?php

                        if(!Yii::app()->user->isGuest){

                         $this->widget('zii.widgets.CMenu',array(

                        'items'=>array(

                                array('label'=>'Orders', 'url'=>array('/orders')),

                                array('label'=>'About', 'url'=>array('/site/page', 'view'=>'about')),

                        ),

                )); 

                }

                 ?>



I was stuck on this for a week. Thank you everyone.