I am using yii2 framework. I have two pages business and contact. I have used CRUD to generate the pages. Now I have to get one sub module to access contact when I use business page. I have to get access from business page to contact using URL. Once I click contact from business page it should redirect me to the contact page. What should I do? I have tried to create modules in gii. But I am not getting class IndexAction as well.
<?php
namespace app\modules\help\controllers;
use yii\base\Action;
class IndexAction extends Action
{
public function run()
{
$this->controller->render('index');
}
}
Yii2 supports nested modules. It's covered in documentation here.
Here is basic example:
namespace app\modules\forum;
class Module extends \yii\base\Module
{
public function init()
{
parent::init();
$this->modules = [
'admin' => [
// you should consider using a shorter namespace here!
'class' => 'app\modules\forum\modules\admin\Module',
],
];
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With