Book Image

Yii Project Blueprints

By : Charles R. Portwood ll
Book Image

Yii Project Blueprints

By: Charles R. Portwood ll

Overview of this book

Table of Contents (15 chapters)
Yii Project Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 {}
  2. Then, create an init() method for the module:

    public function init() {}
  3. Within the module, we'll want to set the layoutPath so that...