In Yii2, I have manually added a new page backend/views/site/new.php
.
Then I have given a link in the page backend/views/site/index.php
:
<a href="<?= Yii::$app->urlManager->createUrl('site/new'); ?>"> New</a>
When I click the link it shows:
Not Found (#404)
What's the issue here?
Create action in SiteController.php
like below
public function actionNew()
{
return $this->render('new');
}
And also create new.php
file in views/site/new.php
Add New
page link in the page backend/views/site/index.php
like
<?= Html::a('New', ['new']) ?>