Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6604725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:11:42+00:00 2026-05-25T19:11:42+00:00

I am having problems having my CSS applied when a menu item links to

  • 0

I am having problems having my CSS applied when a menu item links to a specific record.

Take the simple menu below, the CSS as defined in Menu works just fine for ‘Account’ but when I click on ‘My Account’ it doesn’t.

<div id="Menu">
    <?php $this->widget('zii.widgets.CMenu',array(
        'items'=>array(
        array('label'=>'Account', 'url'=>array('/account/view'),  
                // CSS works fine
        array('label'=>'My Account', 'url'=>array('/account/view/id/'.Yii::app()->user->id), 
                // CSS applied to active link does not work
            ),
        )); 
    ?>
</div>

CSS

#Menu ul li.active a {
    color: #CCC;
    text-decoration:none;
}

Any ideas???

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:11:43+00:00Added an answer on May 25, 2026 at 7:11 pm
    <div id="Menu">
        <?php $this->widget('zii.widgets.CMenu',array(
            'items'=>array(
            array('label'=>'Account', 'url'=>array('/account/view'),  
                    // CSS works fine
            array(
                'label'=>'My Account',
                'url'=>array('/account/view/id/'.Yii::app()->user->id), 
                'active'=>($this->getId() == 'account' && $this->getAction()->getId() == 'view' && isset($_GET['id'])))
                    // you have to set manually the rule for "active"
                ),
            )); 
        ?>
    </div>
    

    Also you should correct your Url rules so you can create URLs properly like this:

    'url'=>array('account/view', 'id'=>Yii::app()->user->id)
    

    To obtain the correct url from this you should create URL rule in config file like this:

    'rules'=>array(
        ....
        '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
        '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
        ....
    ),
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having problems styling form fields with CSS. As you can see below
Basically I'm having some problems with Z-Index. Although I'm not amazing at CSS I
I'm trying to implement a CSS menu and am having a problem with the
I'm still having problems with loading the style sheet for these pages. Works fine
i have built jQuery drop-down menu which is having problems floating over the UI
I have the jsf code and css code below. I'm having trouble getting the
Hi I am having problems with some css classes in joomla. I have two
I am having problems using CSS and margins. I have a list that the
I'm having problems with figuring out the ability to use css stylesheets in actionscript.
I am having problems messing with some css to get it to look the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.