A simple config file (application / configs / application.ini)

来源:互联网 发布:网络游戏软件出售 编辑:程序博客网 时间:2024/04/29 10:28

We will need this configuration file to setup some default values for our application. We will see in the next tutorial how the index.php uses this file and passes its values to the application class to create an instance.

As you can see we have three parts in our configuration file, a config setp for the production environment. Another for the testing environment which inherits the values set for the production mode but changes some values. Finally a setup for the development environment which inherits the values from testing mode (and therefore also from production mode) but also changes some values.

In the php settings part we disable error messages in production mode but enable them for the other environments.

The second part sets the path to our library folder. 

The fourth part sets the application directory path and sets the name we want to use for our bootstrap file.

The fifth part liste the modules we will add to our application, i will use those values in different parts of my application, more about this in one of my next tutorials.

In the sixth part we set some values for the frontcontroller. We will put our modules in a folder called "modules" and we will use homepage as name for our main (default) module. The name of the default controller will be "index" and the default action will have the name "index". The next value tells zend framework to use a prefix for the default module. By default zend framework allows you to ommit the prefix for the files in the default module folder. I set this value to true because there are so much things you have to explain to somebody that is new to zend framework, that's why i prefer not having to explain which module is the default one and that only for this module you should not use a prefix. I set throw exceptions to false, because i dont want exceptions to popup as soon as they get thrown. If you set throwExceptions to true the try / catch in our index file will handle the error. I want to use the error controller that we will build during one of the next tutorials. In the last key / value pair we set the application environment we have set in the htaccess and defined in the index.php so that zend framework can pass it to the frontcontroller.

The last part is for website "myapp" specific values, right now we only need one value, the default title for the title tag in our html pages.

Those are all the values we want to use for our production environment, our testing and development environments will inherit those values, but we will also override some of them. 

We will add lots more value / pair later in other tutorials but right now its already more then enough to get started. 

 

原创粉丝点击