6

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');
    }

}
robsch
  • 9,358
  • 9
  • 63
  • 104
user4809486
  • 65
  • 1
  • 5
  • What do you for submodules? why you are using modules for accessing pages? Do you need really modules or simply you need to access ad the pages? – ScaisEdge Apr 30 '15 at 17:41

1 Answers1

7

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',
            ],
        ];
    }
}
arogachev
  • 33,150
  • 7
  • 114
  • 117