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'); } } 
1
  • 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? Commented Apr 30, 2015 at 17:41

1 Answer 1

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', ], ]; } } 
Sign up to request clarification or add additional context in comments.

1 Comment

Does the default route needs to be defined as well?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.