SlideShare a Scribd company logo
1 of 14
ORGANIZE DIRECTORIES FOR APPLICATIONS
WITH FRONT-END AND BACK-END WITH YII
Author : Nguyen Van Cuong
INTRODUCTION
 Large applications are often divided into front-end
and back-end (or even more ends) depending on
the target user groups
 The front-end should be used by common users,
while the back-end mainly the administrators or
staff members
 Example :
Need build a custom school system,
This have a front end and back end.
front end:
teachers,
students
parents
- administrator who can manage all, create schedule etc etc
- form builder (drag and drop).
back end:
Super administrator
- Customize fields (change fields name)
- Customize category
HOW ?
 Have many another way to organize directories .
 One way to organize directories using
WebApplicationEnd behavior.
 Front-end SiteController and all front-end views are
files generated by yiic tool. You have to create
back-end SiteController and back-end views by
yourself
 Create different config files for both ends. Since
these files usually have much in common, we will
"inherit" them from the main.php config:
STEP 1
 webroot/protected/config/admin.php :
return CMap::mergeArray(
require(dirname(__FILE__).'/main.php'),
array(
// Put front-end settings there
// (for example, url rules).
)
);
 webroot/protected/config/home.php :
we config similar…
 By default, Yii will try to find controllers and views in
protected/controllers and protected/views
directories respectively. We have to change this
behavior and force Yii to search controllers and
views in the "back" or "front" subdirectories
depending on the currently running end.
 Create a file "WebApplicationEndBehavior.php"
with the following contents:
STEP 2
class WebApplicationEndBehavior extends CBehavior {
private $_endName;
public function getEndName() {
return $this->_endName;
}
public function runEnd($name) {
$this->_endName = $name;
$this->onModuleCreate = array($this, 'changeModulePaths');
$this->onModuleCreate(new CEvent($this->owner)); $this->owner-
>run();
}
public function onModuleCreate($event) {
$this->raiseEvent('onModuleCreate', $event);
}
protected function changeModulePaths($event) {
$event->sender->controllerPath .=
DIRECTORY_SEPARATOR.$this->_endName;
$event->sender->viewPath .=
DIRECTORY_SEPARATOR.$this->_endName;
}
 Now add some lines to the main config file:
'behaviors'=>array(
'runEnd'=>array(
'class'=>'application.components.WebApplicationE
ndBehavior',
),
),
 Now our application has a new method runEnd (to run
one of the application's ends) and a new event
onModuleCreate. By raising this event from a web
module we can change modules' properties. Controllers
and views paths are changed in the attached handler
"changeModulePaths".
STEP 3
 Finally, let's protect back-end by creating a parent
controller for all back-end controllers
 webroot/protected/controllers/back/SiteController.ph
p must extend this controller to perform access
checking.
 After all , create new index.php and backend.php
files are:
BENEFITS
 The advantages of this Organize directories is :
controller and the view of the two part - and page
admin server - is totally independent of each other,
but they use the same model folder. This is useful
because the actual website your homepage and the
management will take data from one database to
only. And more, when generate code using the
code gii still be included in the corresponding !
THANK YOU !

More Related Content

What's hot

Desenvolvimento web com Ruby on Rails (parte 4)
Desenvolvimento web com Ruby on Rails (parte 4)Desenvolvimento web com Ruby on Rails (parte 4)
Desenvolvimento web com Ruby on Rails (parte 4)
Joao Lucas Santana
 
Cake fest 2012 create a restful api
Cake fest 2012 create a restful apiCake fest 2012 create a restful api
Cake fest 2012 create a restful api
ceeram
 

What's hot (19)

Spout - Building a RESTful web app with Angular.js and BEAR.Sunday
Spout - Building a RESTful web app with Angular.js and BEAR.SundaySpout - Building a RESTful web app with Angular.js and BEAR.Sunday
Spout - Building a RESTful web app with Angular.js and BEAR.Sunday
 
Desenvolvimento web com Ruby on Rails (parte 4)
Desenvolvimento web com Ruby on Rails (parte 4)Desenvolvimento web com Ruby on Rails (parte 4)
Desenvolvimento web com Ruby on Rails (parte 4)
 
Introduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress DevelopersIntroduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress Developers
 
Conexion php
Conexion phpConexion php
Conexion php
 
Spout
SpoutSpout
Spout
 
Working with disconnected data in Windows Store apps
Working with disconnected data in Windows Store appsWorking with disconnected data in Windows Store apps
Working with disconnected data in Windows Store apps
 
Angular JS Routing
Angular JS RoutingAngular JS Routing
Angular JS Routing
 
Introduction to Spring Cloud Kubernetes (July 4th, 2019)
Introduction to Spring Cloud Kubernetes (July 4th, 2019)Introduction to Spring Cloud Kubernetes (July 4th, 2019)
Introduction to Spring Cloud Kubernetes (July 4th, 2019)
 
Cake fest 2012 create a restful api
Cake fest 2012 create a restful apiCake fest 2012 create a restful api
Cake fest 2012 create a restful api
 
Javascript and jQuery intro
Javascript and jQuery introJavascript and jQuery intro
Javascript and jQuery intro
 
Using schemas in parsing xml part 2
Using schemas in parsing xml part 2Using schemas in parsing xml part 2
Using schemas in parsing xml part 2
 
Migrating to-Drupal-8 by Bryan Manalo
Migrating to-Drupal-8 by Bryan ManaloMigrating to-Drupal-8 by Bryan Manalo
Migrating to-Drupal-8 by Bryan Manalo
 
Migrating Drupal 7 to Drupal 8
Migrating Drupal 7 to Drupal 8Migrating Drupal 7 to Drupal 8
Migrating Drupal 7 to Drupal 8
 
Web view
Web viewWeb view
Web view
 
Dart and AngularDart
Dart and AngularDartDart and AngularDart
Dart and AngularDart
 
Building scalable products with WordPress - WordCamp London 2018
Building scalable products with WordPress - WordCamp London 2018Building scalable products with WordPress - WordCamp London 2018
Building scalable products with WordPress - WordCamp London 2018
 
Image upload in php MySql
Image upload in php MySqlImage upload in php MySql
Image upload in php MySql
 
Simple acl with laravel
Simple acl with laravelSimple acl with laravel
Simple acl with laravel
 
[Srijan Wednesday Webinars] Routing in Drupal 8: Decoupling hook_menu
[Srijan Wednesday Webinars] Routing in Drupal 8: Decoupling hook_menu[Srijan Wednesday Webinars] Routing in Drupal 8: Decoupling hook_menu
[Srijan Wednesday Webinars] Routing in Drupal 8: Decoupling hook_menu
 

Similar to Organize directories for applications with front-end and back-end with yii - CuongNV

Web applications with Catalyst
Web applications with CatalystWeb applications with Catalyst
Web applications with Catalyst
svilen.ivanov
 
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
arcware
 
Oaf development-guide
Oaf development-guideOaf development-guide
Oaf development-guide
俊 朱
 
Phpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friendsPhpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friends
Michael Peacock
 

Similar to Organize directories for applications with front-end and back-end with yii - CuongNV (20)

Web applications with Catalyst
Web applications with CatalystWeb applications with Catalyst
Web applications with Catalyst
 
Spring MVC 3.0 Framework (sesson_2)
Spring MVC 3.0 Framework (sesson_2)Spring MVC 3.0 Framework (sesson_2)
Spring MVC 3.0 Framework (sesson_2)
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC Framework
 
Magento Live Australia 2016: Request Flow
Magento Live Australia 2016: Request FlowMagento Live Australia 2016: Request Flow
Magento Live Australia 2016: Request Flow
 
Alfredo-PUMEX
Alfredo-PUMEXAlfredo-PUMEX
Alfredo-PUMEX
 
Alfredo-PUMEX
Alfredo-PUMEXAlfredo-PUMEX
Alfredo-PUMEX
 
Alfredo-PUMEX
Alfredo-PUMEXAlfredo-PUMEX
Alfredo-PUMEX
 
Alfredo-PUMEX
Alfredo-PUMEXAlfredo-PUMEX
Alfredo-PUMEX
 
Build powerfull and smart web applications with Symfony2
Build powerfull and smart web applications with Symfony2Build powerfull and smart web applications with Symfony2
Build powerfull and smart web applications with Symfony2
 
Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For Beginners
 
WordPress Structure and Best Practices
WordPress Structure and Best PracticesWordPress Structure and Best Practices
WordPress Structure and Best Practices
 
Symfony2 revealed
Symfony2 revealedSymfony2 revealed
Symfony2 revealed
 
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
 
Zend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_ToolZend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_Tool
 
Oaf development-guide
Oaf development-guideOaf development-guide
Oaf development-guide
 
How Kris Writes Symfony Apps
How Kris Writes Symfony AppsHow Kris Writes Symfony Apps
How Kris Writes Symfony Apps
 
Phpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friendsPhpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friends
 
Osiąganie mądrej architektury z Symfony2
Osiąganie mądrej architektury z Symfony2 Osiąganie mądrej architektury z Symfony2
Osiąganie mądrej architektury z Symfony2
 
FLOW3, Extbase & Fluid cook book
FLOW3, Extbase & Fluid cook bookFLOW3, Extbase & Fluid cook book
FLOW3, Extbase & Fluid cook book
 
PHP: 4 Design Patterns to Make Better Code
PHP: 4 Design Patterns to Make Better CodePHP: 4 Design Patterns to Make Better Code
PHP: 4 Design Patterns to Make Better Code
 

More from Framgia Vietnam

Timeless - Websocket on Rails
Timeless - Websocket on RailsTimeless - Websocket on Rails
Timeless - Websocket on Rails
Framgia Vietnam
 
CSS3 Lovers, Gather Together
CSS3 Lovers, Gather TogetherCSS3 Lovers, Gather Together
CSS3 Lovers, Gather Together
Framgia Vietnam
 
Build public private cloud using openstack
Build public private cloud using openstackBuild public private cloud using openstack
Build public private cloud using openstack
Framgia Vietnam
 
Introduction to JRuby And JRuby on Rails
Introduction to JRuby And JRuby on RailsIntroduction to JRuby And JRuby on Rails
Introduction to JRuby And JRuby on Rails
Framgia Vietnam
 
Create 3D objects insite Cocos2d-x
Create 3D objects insite Cocos2d-xCreate 3D objects insite Cocos2d-x
Create 3D objects insite Cocos2d-x
Framgia Vietnam
 
View, Store Procedure & Function and Trigger in MySQL - Thaipt
View, Store Procedure & Function and Trigger in MySQL - ThaiptView, Store Procedure & Function and Trigger in MySQL - Thaipt
View, Store Procedure & Function and Trigger in MySQL - Thaipt
Framgia Vietnam
 
What is new in PHP 5.5 - HuyenNT
What is new in PHP 5.5 - HuyenNTWhat is new in PHP 5.5 - HuyenNT
What is new in PHP 5.5 - HuyenNT
Framgia Vietnam
 
Audited activerecord - QuanHV
Audited activerecord - QuanHVAudited activerecord - QuanHV
Audited activerecord - QuanHV
Framgia Vietnam
 
Client side validations gem - KhanhHD
Client side validations gem - KhanhHDClient side validations gem - KhanhHD
Client side validations gem - KhanhHD
Framgia Vietnam
 
Backbone.js and rails - BanLV
Backbone.js and rails - BanLVBackbone.js and rails - BanLV
Backbone.js and rails - BanLV
Framgia Vietnam
 
Jenkins and rails app - Le Dinh Vu
Jenkins and rails app - Le Dinh VuJenkins and rails app - Le Dinh Vu
Jenkins and rails app - Le Dinh Vu
Framgia Vietnam
 

More from Framgia Vietnam (20)

Functional Programming With Elixir
Functional Programming With ElixirFunctional Programming With Elixir
Functional Programming With Elixir
 
Dreamers defense
Dreamers defenseDreamers defense
Dreamers defense
 
Timeless - Websocket on Rails
Timeless - Websocket on RailsTimeless - Websocket on Rails
Timeless - Websocket on Rails
 
Game Development with Pygame
Game Development with PygameGame Development with Pygame
Game Development with Pygame
 
Racer Mice - Game Team
Racer Mice - Game TeamRacer Mice - Game Team
Racer Mice - Game Team
 
CSS3 Lovers, Gather Together
CSS3 Lovers, Gather TogetherCSS3 Lovers, Gather Together
CSS3 Lovers, Gather Together
 
Java 8 new features
Java 8 new features Java 8 new features
Java 8 new features
 
Build public private cloud using openstack
Build public private cloud using openstackBuild public private cloud using openstack
Build public private cloud using openstack
 
Introduction to JRuby And JRuby on Rails
Introduction to JRuby And JRuby on RailsIntroduction to JRuby And JRuby on Rails
Introduction to JRuby And JRuby on Rails
 
Some ways to DRY in Rails
Some ways to DRY in Rails Some ways to DRY in Rails
Some ways to DRY in Rails
 
HTML5 DRAG AND DROP
HTML5 DRAG AND DROPHTML5 DRAG AND DROP
HTML5 DRAG AND DROP
 
Create 3D objects insite Cocos2d-x
Create 3D objects insite Cocos2d-xCreate 3D objects insite Cocos2d-x
Create 3D objects insite Cocos2d-x
 
View, Store Procedure & Function and Trigger in MySQL - Thaipt
View, Store Procedure & Function and Trigger in MySQL - ThaiptView, Store Procedure & Function and Trigger in MySQL - Thaipt
View, Store Procedure & Function and Trigger in MySQL - Thaipt
 
What is new in PHP 5.5 - HuyenNT
What is new in PHP 5.5 - HuyenNTWhat is new in PHP 5.5 - HuyenNT
What is new in PHP 5.5 - HuyenNT
 
An idea - NghiaLV
An idea - NghiaLVAn idea - NghiaLV
An idea - NghiaLV
 
Audited activerecord - QuanHV
Audited activerecord - QuanHVAudited activerecord - QuanHV
Audited activerecord - QuanHV
 
Delegate - KhanhLD
Delegate - KhanhLDDelegate - KhanhLD
Delegate - KhanhLD
 
Client side validations gem - KhanhHD
Client side validations gem - KhanhHDClient side validations gem - KhanhHD
Client side validations gem - KhanhHD
 
Backbone.js and rails - BanLV
Backbone.js and rails - BanLVBackbone.js and rails - BanLV
Backbone.js and rails - BanLV
 
Jenkins and rails app - Le Dinh Vu
Jenkins and rails app - Le Dinh VuJenkins and rails app - Le Dinh Vu
Jenkins and rails app - Le Dinh Vu
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

Organize directories for applications with front-end and back-end with yii - CuongNV

  • 1. ORGANIZE DIRECTORIES FOR APPLICATIONS WITH FRONT-END AND BACK-END WITH YII Author : Nguyen Van Cuong
  • 2. INTRODUCTION  Large applications are often divided into front-end and back-end (or even more ends) depending on the target user groups  The front-end should be used by common users, while the back-end mainly the administrators or staff members
  • 3.  Example : Need build a custom school system, This have a front end and back end. front end: teachers, students parents - administrator who can manage all, create schedule etc etc - form builder (drag and drop). back end: Super administrator - Customize fields (change fields name) - Customize category
  • 4. HOW ?  Have many another way to organize directories .  One way to organize directories using WebApplicationEnd behavior.
  • 5.
  • 6.  Front-end SiteController and all front-end views are files generated by yiic tool. You have to create back-end SiteController and back-end views by yourself  Create different config files for both ends. Since these files usually have much in common, we will "inherit" them from the main.php config:
  • 7. STEP 1  webroot/protected/config/admin.php : return CMap::mergeArray( require(dirname(__FILE__).'/main.php'), array( // Put front-end settings there // (for example, url rules). ) );  webroot/protected/config/home.php : we config similar…
  • 8.  By default, Yii will try to find controllers and views in protected/controllers and protected/views directories respectively. We have to change this behavior and force Yii to search controllers and views in the "back" or "front" subdirectories depending on the currently running end.  Create a file "WebApplicationEndBehavior.php" with the following contents: STEP 2
  • 9. class WebApplicationEndBehavior extends CBehavior { private $_endName; public function getEndName() { return $this->_endName; } public function runEnd($name) { $this->_endName = $name; $this->onModuleCreate = array($this, 'changeModulePaths'); $this->onModuleCreate(new CEvent($this->owner)); $this->owner- >run(); }
  • 10. public function onModuleCreate($event) { $this->raiseEvent('onModuleCreate', $event); } protected function changeModulePaths($event) { $event->sender->controllerPath .= DIRECTORY_SEPARATOR.$this->_endName; $event->sender->viewPath .= DIRECTORY_SEPARATOR.$this->_endName; }
  • 11.  Now add some lines to the main config file: 'behaviors'=>array( 'runEnd'=>array( 'class'=>'application.components.WebApplicationE ndBehavior', ), ),  Now our application has a new method runEnd (to run one of the application's ends) and a new event onModuleCreate. By raising this event from a web module we can change modules' properties. Controllers and views paths are changed in the attached handler "changeModulePaths".
  • 12. STEP 3  Finally, let's protect back-end by creating a parent controller for all back-end controllers  webroot/protected/controllers/back/SiteController.ph p must extend this controller to perform access checking.  After all , create new index.php and backend.php files are:
  • 13. BENEFITS  The advantages of this Organize directories is : controller and the view of the two part - and page admin server - is totally independent of each other, but they use the same model folder. This is useful because the actual website your homepage and the management will take data from one database to only. And more, when generate code using the code gii still be included in the corresponding !