Yii  framework is a fast and secure framework for developing PHP applications. A module in Yii is a self contained application unit which comprises of several supporting features, models, controllers and views.

Create Module:

A module is organized as a directory whose name serves as its unique ID.
Structure of module:
example/
ExampleModule.php  –  the module class file
components/  –   containing reusable user components
views/   –  containing view files for widgets
controllers/  –  containing controller class files
DefaultController.php  –   the default controller class file
extensions/ – containing third-party extensions
models/  –  containing model class files
views/ – containing controller view and layout files
layouts/ – containing layout view files
default/  –  containing view files for DefaultController
index.php – the index view file

Create the following urlManager rules in /protected/config/main.php:

In /protected/modules/user/controllers/DefaultController.php have something like:

Create a /protected/modules/user/config directory and add a main.php file with something like:

Modules are useful in several scenarios. For a large-scale application, we may divide it into several modules, each being developed and maintained separately. Some commonly used features, such as user management, comment management, may be developed in terms of modules so that they can be reused easily in future projects.

Courtesy: yiiframework.com

Know More About This Topic from our Techies

Post By : Dibin Kumar (1 Posts)

""


You might also like...

INDIA OFFICE

info@cubettech.com
+91 484 4054324
Skype : cubettech
Carnival infopark,
Unit IX-C, 9th floor PhaseIV,
Kochi, Kerala, India

LONDON OFFICE

info@cubettech.com
+44 2071938618
Skype : cubettech
Kemp House
160 City Road
London- EC1V2NX, UK.
Top