Revision #3                                    has been created by 
 auxbuss                                    on Jul 29, 2009, 7:14:04 PM with the memo:
                                
                                
                                    Minor edits                                
                                                                    « previous (#2)                                                                                                    next (#4) »                                                            
                            Changes
                            
    Title
    unchanged
    How to access a component of a module from within the module itself
    Category
    unchanged
    Tutorials
    Yii version
    unchanged
    
    Tags
    unchanged
    
    Content
    changed
    The Yii documentation states:
> An application module may be considered as a self-contained sub-application that has its own controllers, models and views and can be reused in a different project as a whole. Controllers inside a module must be accessed with routes that are prefixed with the module ID.
So
, in practic
allye, a module can be handled 
just aslike an application, 
but with
 only minor differences.
Suppos
inge you 
were havinghad a custom component 'foo' in your application:
```php[...]
```
A...and you need to move it inside a module called 'bar':
```php[...]
```
Now instead of using the component as usual:
```php
Yii::app()->foo
```
You 
need to call it like thiscall it from within the module:
```php
Yii::app()->controller->module->foo
```
As you can see, your module is indeed just another application, and you can configure any parameters as you'd do with your "root" application. The only organizat
oryional differences are:
+ a module has a module "entry point", the FooModule which extends CWebModule
, w. Whereas the root application is bootstrapped by the framework itself, starting with your entry script (index.php)
+ the application's SiteController is called inside a module DefaultController