Loading a Custom Config File

There might be times when you want to load a custom config file for your application, in order to easily maintain your database login information or override default settings.

There are two main options available to load your custom configuration into the framework. The first option is to create a file called gateway.config.php inside the raxan/pdi folder. This file will be automatically detected and loaded by the framework.

Raxan PDI includes a sample configuration file called gateway.config.sample.php, that's also located inside the raxan/pdi folder. You can copy and rename this file to gateway.config.php, then use your favorite text editor to modify the default settings.

The second option is to use the Raxan::loadConfig() method as shown in the example below:

<?php

    require_once 'raxan/pdi/gateway.php';

    Raxan::loadConfig('include/myconfig.php');

    // ...your code here...

?>

In addition to loading your a config file, you can also make on the fly configuration changes by using the Raxan::config($key, $value) method:

<?php

    require_once 'raxan/pdi/gateway.php';

    Raxan::config('views.path','html/views/');

?>

Sample Confiugration Options

All path and url settings must have a trailing slash (/)

Path/URL setting

  • base.path - Absolute path to PDI folder. This path is automatically assigned by the system.
  • site.locale - Site locale code. Defaults to 'en-us'
  • site.lang - Site language code. Defaults to 'en' (English). Must correspond with language folder
  • site.charset - Charset code. Defaults to 'UTF-8'
  • site.timezone - sets the timezone to use by the framework. e.g. America/Toronto.
  • site.email - Site email addess
  • site.phone - Site phone number
  • site.url - URL path to website. Defaults to the url for the current page.
  • site.path - Absolute folder path to site root. Defaults to the path for the current page
  • views.path - Absolute folder path to the views folder. Defaults to {site path}/views/

  • raxan.url - URL path to raxan folder. Defaults to './raxan/'

  • raxan.path - Absolute path to the raxan folder. Defaults to {base path}/../
  • cache.path - Not Used. Absolute path to cache folder. Defaults to {raxan path}/cache/
  • locale.path - Absolute path to locale folder. Defaults to {base path}/shared/locale/

  • plugins.path - Absolute path to the plugins folder. Defaults to {raxan path}/plugins/

  • widgets.path - Absolute path to the widgets folder. Defaults to {raxan path}/ui/widgets/

Session setting

  • session.name - PHP session name. Change for each NEW application to prevent PHP sessions from being shared across applications. Session name must be short and contains only alphanumeric characters.
  • session.timeout - PHP cookie session timeout value in minutes. Defaults to 30 minutes
  • session.data.storage - Session data storage class. Defaults to RaxanSessionStorage

Note: The session data storage class is responsible for generating unique Ids for each user. See RaxanSessionStorage for more details.

Database Connection setting

  • db.default - An array containing default database configuration. See gateway.config.sample.php for more information.

    // Database connector example
    $config['db.default'] = array(
        'dsn'       => 'mysql: host=localhost; dbname=employees',
        'user'      => 'empuser',
        'password'  => 'password',
        'attribs'   => ''
    );
    

Note: Additional databases can be configured by adding the "db." prefix the configuration name. For example "db.mysql"

Logging/Debuging

  • debug - Enable/Disable debug mode. Defaults to false.
  • debug.log - Enable/Disable log message to debug window. Defaults to false.
  • debug.output - Set debug output mode. Accepted values: embedded, alert, popup, console. Defauls to embedded.
  • log.enable - Enable/Disable logger. Defaults to false
  • log.file - Set log file mode. Defaults to PHP logger

Error Page settings

To display a custom message, add the {message} placeholder inside the html file.

  • error.400 - File path to 400 error page template.
  • error.401 - File path to 401 error page template.
  • error.403 - File path to 403 error message template.
  • error.404 - File path to 404 error message template.

Web Page default settings

  • page.localizeOnResponse - Loacalize web page content based on the langid attribute
  • page.initStartupScript - Loads the raxan startup.js script
  • page.resetDataOnFirstLoad - Reset page data on first load
  • page.preserveFormContent - Preserve form content during post back
  • page.disableInlineEvents - Disables the processing of inline events.
  • page.masterTemplate - Page master template - html source or file name
  • page.serializeOnPostBack - Default selector value for matched elements to serialize during post back. e.g. form
  • page.degradable - Enables accessible event binding for links, forms and submit buttons
  • page.showRenderTime - Shows the page render time
  • page.data.storage - Page data storage class. Default to RaxanWebPageStorage

Note: The page data storage class will be passed the data store name of the current page. See RaxanWebPageStorage for more details.

Preload Plugins and UI Widgets

These options provide a convenient way to load multiple plugins and widgets. For example, plugin1, plugin2, plugin3.php, etc If the extension .php was specified then the plugin or widget with be loaded relative to site.path.

  • preload.plugins - Comma (,) separated list of plugins to be loaded from plugins.path
  • preload.widgets - Comma (,) delimited list of UI widgets to be loaded from widgets.path