fhqrnr
(Fhqrnr)
May 24, 2014, 6:37am
1
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.
samdark
(Alexander Makarov)
May 24, 2014, 12:01pm
2
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.
epulgaron
(Jokercrazy05544)
February 23, 2015, 3:25pm
4
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> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </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
abhi16_93
(Abhimanyu)
February 24, 2015, 5:40pm
5
@epulgaron
The syntax for generating hyperlink tag [color="#333333 "]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'])?>
[/color]