Nov 27, 2010

The business configuration files

In Simple MVC, the business configuration files are splitted as follow :

|-- business
      |-- conf
      |   `-- apps.ini.changeme
      `-- front
          |-- conf
          |   |-- access.ini
          |   |-- front.ini.changeme
          |   |-- languages.en.ini
          |   `-- user_rights.ini

the business/conf folder contains a file named apps.ini.changeme. This file specifies common configuration for the business layer, it should be renamed to apps.ini and customized. Here is its content :

host = localhost;
user = *****;
password = *****;
database = *****;
type = mysql;
URL =;
autorender_template = 1;
;allowed types : Array, File, APC
type = File;
prefix = simplemvc;
directory = /tmp;

So as you notice, the file contains global sections like database, which handles the database connection params, template, controller, model and view sections, and cache section. Those can be a global placeholder for your common configurations across your applications.

You can then override those sections per application. For each Application you write, you must add a .ini file under business//conf/. So in our case, business/front/conf/front.ini. by default you have a front.ini.changeme for the module front. I’ve already put the configuration by default in this file :

application.session.checkFrequency = "300000";
images.destination_dir = "/the/path/to/your/images/uploads/";
images.destination_url = "/images/uploads/";
rss.ttl = 10000;

You have to copy that file under front.ini and from there, you can override the global conf file. for example, if you have two applications that are dealing with different database connections, you can overrite the database section to sepecify the connection params for each application.

Also, remember in the boostrap file, we had some lines of code that were dealing with access. The helper was actually looking for the acces.ini configuration file ccess.ini :
This file indicates if each action should be public or protected.

; Access Config file : 
; 0 - public
; 1 - protected
Feed.index = 0;
Feed.detail = 0;
Feed.add = 1;

This is basically what we need to get the config working.
Move on to the next section, let’s take a look at our first page!

1 Comment

Leave a comment