Error on Guest page! without login

I received an error even if I had mentioned a condition in the menu array as below


array('label'=>'Reservation Requests <span class="badge badge-info pull-right">'.(Yii::app()->user->isGuest)? Message::model()->CountofReservationRequests(null) :''.'</span>', 'url'=>array('/site/login'), 'visible'=>!Yii::app()->user->isGuest),

What error?

Error means, its checking in the database (gives me database error) even if the user is logged out. the condition !Yii::app()->user->isGuest does not apply

You’ve got brackets in wrong places.




array(

    'label' => 'Reservation Requests <span class="badge badge-info pull-right">' . 

        (Yii::app()->user->isGuest ? Message::model()->CountofReservationRequests(null) : '') . '</span>',

    'url' => array('/site/login'),

    'visible' => !Yii::app()->user->isGuest

),



And I think it should be other way around but it’s just a wild guess




array(

    'label' => 'Reservation Requests <span class="badge badge-info pull-right">' . 

        (Yii::app()->user->isGuest ? '' : Message::model()->CountofReservationRequests(null)) . '</span>',

    'url' => array('/site/login'),

    'visible' => !Yii::app()->user->isGuest

),



Thanks Bizley!! I missed the brackets somewhere, now works fine