Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > Tab menu - add style when IF logged in?? View modes: 
User avatar
Member
Member
eagleag - 11/26/2009 3:03:55 AM
   
Tab menu - add style when IF logged in??
Hi,
I am using a Tab menu as my main navigation.
I would like to add a style to one of the menu items but only when someone is logged in.
example:

"about us" - when user not logged in -> color:red;, hover -> blue;
"about us" - when user IS logged in -> color: blure; , hover -> blue;

How can I add css on condition that user is logged in?

Many Thanks :)

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 11/28/2009 3:52:07 AM
   
RE:Tab menu - add style when IF logged in??
Hello,

you can create two stylesheets - one to be used when user is logged in and one to be used when user is not logged in. Then you can create copy of 'headhtml' web part from 'General' category and modify this copy to generate link to appropriate stylesheet into head section of page in according to if user is logged in or not. You can check if user is logged in using following code:

if (CMS.CMSHelper.CMSContext.CurrentUser.IsAuthenticated)
{
//user is logged in
}
else
{
//user is not logged in
}

Best Regards,

Martin Dobsicek