简体   繁体   中英

How can I install a yii extension, making it available to my whole web application?

Recently I decided to study php and I discovered yii framework. At first glance it seemed very easy to work with it but now I am struggling to configure my web application for installing an extension to work with Enums. I downloaded this extension from their web site and I put it within extensions folder. The issue is that I am not able to call the subclasses that I created in my code. I created a few classes that extend from this superclass (extension).

Which configuration I must do to make this extension class, available to my web application code?

As I said I just put that extension class in my extensions folder and I am just instantiating them, inside controller's methods. When I run the code I see the same error message no matter any configuration I make:

include (xxx.php): failed to open stream: No such file or directory

If anyone does want to know more about this extension this is the page that shows some information about that.

http://www.yiiframework.com/extension/enum/

in config/main.php you should add your extension details in the components array, something like:

    return array(
        // 'preload'=>array('xyz',...),
        'components'=>array(
            'xyz'=>array(
                'class'=>'ext.xyz.XyzClass',
                'property1'=>'value1',
                'property2'=>'value2',
            ),
            // other component configurations
        ),

);

where xyz is an extension

or just put it in the extensions folder and import it by Yii::import('application.extensions.extensionname.*');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM