Yii Framework Forum: Right Configuration But Still 404 When I Added An Item To Menu (Yii2.0) - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Right Configuration But Still 404 When I Added An Item To Menu (Yii2.0) Rate Topic: -----

#1 User is offline   fhqrnr 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 24-May 14

Posted 24 May 2014 - 01:37 AM

The steps:
1: I added an item named "manageservice" to menu in "frontend/views/layouts/main.php".

            $menuItems = [
                ['label' => 'index', 'url' => ['/site/index']],
                ['label' => 'about, 'url' => ['/site/about']],
                ['label' => 'manager', 'url' => ['/site/manageservice']],
//                ['label' => 'Contact', 'url' => ['/site/contact']],
            ];


2: Added a php file named "manageservice.php" into folder "frontend/views/site".

3:added a function to "SiteController.php" (locat in "frontend/Controllers/"):

    public function actionManageService()
    {
        return 'test';
//        return $this->render('manageService');
    }


then i click "manager" button , i got
"Not Found (#404)
Unable to resolve the request: site/manageservice "


i don't know where is my mistake or the yii's bug.
0

#2 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,788
  • Joined: 17-January 09
  • Location:Russia

Posted 24 May 2014 - 07:01 AM

The issue is that your action name is actionManageService. Note uppercase S. For such action the route is manage-service and not manageservice. It's pointed out in documentation.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#3 User is offline   fhqrnr 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 24-May 14

Posted 03 June 2014 - 09:28 AM

View Postsamdark, on 24 May 2014 - 07:01 AM, said:

The issue is that your action name is actionManageService. Note uppercase S. For such action the route is manage-service and not manageservice. It's pointed out in documentation.



thanks, it was solved.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users