1 Configuration environments
In the portal there are configurations for five independent environments:
- frontend application
- frontend console application (migrations etc.)
- backend application (can be used for higher security)
- unittests
- unittests console application (migrations etc.)
Configurations are stored as PHP key-value array.
2 Frontend application
Configuration consists of two files:
- <portal>/frontend/config/main.php – default configuration (do not change – will be overwritten by update)
- <portal>/custom/config/client_main.php – client-specific configuration – overwrites options in main.php
Before you run the application, these two files are merged into one array. Each option with the same key from client_main.php overwrites the same option from main.php (default configuration).
Values with keys are overwritten. But arrays are merged not overwritten.
It is also possible to define an instance specific config file (e.g. for different configs in developement / productive systems). If an file is set it is also merged into the array (at the end, overwrites already exisiting keys). To use an instance specific config file just create a new .php file and return an array containing the instance-configuration. In client_instance.php you then have to specify the filename of the instance file, which should be loaded.
You can customize the path to main mail layout for each module if it is neaded (default ‘//layouts/mail’). A layout can be placed in the directory of the views of module. For example: common/modules/shoppingcart/views/mail_templates/checkout_mail
'shoppingcart' => array( 'mainMailTemplate'=> 'shoppingcart.views.mail_templates.checkout_mail' )
This means if you have options like:
main.php: 'var1’=> array( 'value1’ ) client_main.php 'var1’=> array( 'client_value’ ) Merge result: 'var1’=> array( 'value1’ 'client_value’ ) NOT: 'var1’=> array( 'client_value’ )
To prevent such problems move options fully in client_main.php OR add keys for each option.
All pieces of configuration in the next guides refers by default to main.php if not specified otherwise.
3 Frontend console application
This configuration is not split in two sections like main.php to reduce unnecessary complexity.
Configuration is in file <portal>/custom/config/client_console.php.
This configuration is used by script <portal>/common/yiit.
4 Backend application
Currently not in use. Could be used to separate for example User Administration in a different portal site for higher security. Administrators could get limited access to this site.
5 Unit tests
Unit tests need separate environment for running.
Configuration is in file <portal>/tests/config/main.php
6 Unittests console application
Configuration is in file <portal>/custom/tests/client_console.php.
This configuration is used by script <portal>/tests/yiit.
7 Change main layout for administration
You can change the main layout template with the parameter ‘layoutForBackend’
// settings in user admin area 'settings' => array( 'class' => 'common.modules.settings.SettingsModule', 'fields' => array( 'defaultLandingPage', ), 'layoutForBackend' => '//layouts/gportal', ),
8 Change main layout for mail templates (customizing)
If the module is inherited from WebCustModule class, you can to specify a parameter “mainMailTemplate” in custom/config/client_main.php.
'shoppingcart' => array( 'mainMailTemplate'=> '//layouts/checkout_mail' )
If this parameter is not specified, ‘//layouts/mail’ will be used.