O'Reilly logo

Yii Project Blueprints by Charles R. Portwood II

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating the module

Now that our application is set up, we can begin to create our module. We'll start by creating the basic folder structure within our protected/modules directory:

protected/
   [...]
   modules/
      /dashboard
         assets/
         components/
         config/
         controllers/
         views/
            layouts/
            user/
            category/
            filemanager/
            default/

As you can see, the basic structure of our module looks identical to that of our main application. With our folder structure in place, we now need to create the DashboardModule class that we'll later tell Yii about so that it knows what to load. The steps are as follows:

  1. Start by creating a new file, called DashboardModule.php, within protected/modules/dashboard with the following definition:
    <?php class DashboardModule extends CWebModule ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required