Configuration
From Tlalokes
Once installed the framework and with you recently generated basic application's structure, it's time to configure, in order to do that open the config.php file located in your application's directory.
Contents |
Example
This is an example of a configuration file:
$c['key'] = 'c20ad4d76fe97759aa27a0c99bff6710'; $c['path']['controllers'] = 'control/'; $c['path']['views'] = 'view/'; $c['path']['model'] = 'model/'; $c['path']['bss'] = 'model/business/'; $c['path']['def'] = 'model/dbo/def/'; $c['path']['orm'] = 'model/dbo/orm/'; $c['path']['tmp'] = '_tmp/'; $c['path']['tpl_compile'] = '_tmp/compile/'; $c['path']['tpl_cache'] = '_tmp/cache/'; $c['path']['locales'] = '_locale/'; $c['path']['libs'] = 'lib/'; $c['path']['core'] = 'core/'; $c['default']['controller'] = 'Test'; $c['default']['locale'] = 'eng'; $c['default']['charset'] = 'UTF-8'; $c['mode']['smarty'] = 'production'; $c['mode']['propel'] = 'production'; $c['dsn']['type'] = 'mysql'; $c['dsn']['host'] = 'localhost'; $c['dsn']['name'] = 'test'; $c['dsn']['username'] = 'foo'; $c['dsn']['password'] = 'bar'; $c['execute']['crud_propel_smarty'] = true;
Descriptions
Key
The key allows you to execute builders and modes. The key content is a hash md5, example:
$c['key'] = 'c20ad4d76fe97759aa27a0c99bff6710';
Paths
It is suggested not to change this locations.
- Application Here you can find the areas inside the application:
Controllers
$c['path']['controllers'] = 'control/';
Views
$c['path']['views'] = 'view/';
Models
$c['path']['model'] = 'model/';
Business logic components
$c['path']['bss'] = 'model/business/';
Definition Objects
$c['path']['def'] = 'model/dbo/def';
Locales
$c['path']['locales'] = '_locale';
- Framework Here you can find the framework's areas:
Libraries
$c['path']['libs'] = 'lib/';
Defaults
In this areas you can set the default elements such as: controller, locale and characters set.
Controller
$c['default']['controller'] = 'Test';
Locale
$c['default']['locale'] = 'eng';
Character sets (charset)
The available charsets are:
- UTF-8
- ISO-8859-1
- ISO-8859-15
- cp866
- cp1251
- cp1252
- KOI8-R
- BIG5
- GB2312
- BIG5-HKSCS
- Shift_JIS
- EUC-JP
we encourage you to use UTF-8
$c['default']['charset'] = 'UTF-8';
Modes
Smarty. Tlalokes includes (but not force to use) the template engine Smarty, in this area you can set the modes available for it. Example:
$c['mode']['smarty'] = 'production';
Actually there are two modes: debug and production.
debug. "Compiles" the smarty formated template in to HTML/PHP code during runtime, and writes the "compiled" file in the_tmp/compileddirectory. It's useful when you are coding and testing templates.production. It assumes that compiled templates already exists, and uses that precompiled HTML/PHP templates.
Propel. Tlalokes includes Propel, an object-relational mapping toolkit (ORM). Tlalokes allows you to use Propel in a very easy way with this configurable modes. Example:
$c['mode']['propel'] = 'production';
The available modes are:
build-all. Analyzes the Definition objects, writes all the Propel needed configuration and generates the tables in the database and writes all the ORM code.build-from-db. Analyses the structure of the currently existent database, writes the configurations and the ORM code.build-conf. It only generates the required configuration for Propel and writes it into_tmp/generator.build-tables. It generates your tables from your Definition objects to your database.build-om. Analyses the Definition objects and generates the ORM code.production. Once generated the ORM code is important to set this mode to avoid overwriting of code or tables.
Data Source Name
Relational Database Management Systems (RDMBS) currently supported
- pgsql - PostgrSQL
- mysql - MySQL
- mysqli - MySQLi
- sqlite - SQLite
- odbc - ODBC
- oracle - Oracle
- mssql - MS SQL Server
$c['dsn']['type'] = 'mysql';
Hostname
$c['dsn']['host'] = 'localhost';
Database name
$c['dsn']['name'] = 'test';
User name
$c['dsn']['username'] = 'foo';
Password
$c['dsn']['password'] = 'bar';
Builder's execution
Tlalokes uses a method to generate code named Builders which allows you to generate code from Definition objects or other elements. The framework provides you some default builders, by example the crud_propel_smarty builder that generates Model, View, Controller and Locale code to obtain CRUD (Create Read Edit Delete) catalogs from Definition objects using Propel and Smarty.
To execute a builder you must include it's name into the execute node and set the boolean value true. Example:
$c['execute']['crud_propel_smarty'] = true;
To deactivate or avoid it's execution is only required to change the boolean value to false. Example:
$c['execute']['crud_propel_smarty'] = false;
