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: 4,061
  • 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

#4 User is offline   epulgaron 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 148
  • Joined: 19-February 14

Posted 23 February 2015 - 10:25 AM

i have the same problem, in my PlanificacionController i have this function:
 public function actionPdf()
{
  
  $pdf = Yii::$app->pdf;
  //Returns the HTML content and put it in the PDF content
  $pdf->content = $this->renderPartial('dinamicoTotal',[]);
  return $pdf->render();
}


this is my view
<?=
     
     '<table width="200" border="1">
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>';?>


in my index i created this button
<?= Html::a(Yii::t('app', 'pdf'),['dinamicoTotal'],['class' => 'btn btn-success'])?>


but when i click it i've got "page not found"

what i'm doing wrong? i'm tryng to export this view to pdf file

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.

0

#5 User is offline   Abhimanyu Saharan 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 07-February 15

Posted 24 February 2015 - 12:40 PM

@epulgaron
The syntax for generating hyperlink tag is
Html::a($text, $url = null, $options = [])
. so, in your case, it would be
<?=Html::a(Yii::t('app', 'pdf'),['pdf'],['class'=> 'btn btn-success'])?>

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