System settings

In the root folder of the project there is a "config" folder with different configuration files as follows:

  • models.php - active models
  • plugins.php - active plugins
  • routes.php - routes to bind URLs and templates
  • settings.php - general settings
  • setup.php - current server settings (to launch the project on a new server or transfer it from a local server to a production one)

The settings are presented as standard arrays (models, plugins) and associative arrays (routes and all other settings). It's possible to add new settings, and they will be available everywhere through the Registry object.

Main settings

  • Mode - work mode "development" or "production" (in "development" mode PHP, PDO, Swift Mailer errors will be displayed on the screen, in "production" mode framework writes them into "/log/" folder)
  • DbEngine, DbFile, DbHost, DbUser, DbPassword, DbName - database settings (DbFile – for SQLite only)
  • TimeZone - time zone of the website, values look like "Etc/GMT-7"
  • DomainName - domain name of the website (without trailing slash)
  • MainPath - URL path from the server’s root to the project, on working server usually "/"
  • AdminFolder - the name of admin panel folder (to change the name of the folder you need to change this setting and rename the folder)
  • SessionSupport - standard PHP session support (when "true" - "session_start()" will be called), more details - in Working with sessions section
  • SecretCode - special code to make hashes and different tokens, is filled manually one time
  • FilesPath - a folder with user's files, there are also useful methods to work with files in Special Methods, and Files and Images sections
  • ModelVersionsLimit - limit of kept content versions for all models, also it can be set individually for each model (see Model Settings)

Access to settings

For access to the settings of models and templates an object of Registry class is being used, which is available inside each model, plugin and "$mv" object. Registry object uses one array to store the settings, that is why the names (arrays keys) in settings.php and setup.php files shouldn’t be the same.

For the classes of models the "MainPath" setting is available as "$root_path" property, an object described in MV object section has a similar property.

//Samples on how to get settings 
$mv -> registry -> getSetting("DomainName");
$mv -> registry -> getSetting("SecretCode");

class Articles extends Model

   public function display()

       $html .= $this -> registry -> getSetting("MainPath")."article/".$row["id"]."/";

       //Alternative way for root path
       $html .= $this -> root_path."block/".$row["id"]."/";

//We can add our own settings on the fly and they will be available throughout the project 
$mv -> registry -> setSetting("MySetting", 57);

Settings to launch a project

To launch or transfer a project to the production server you need to change "setup.php" file, which is responsible for local settings of the server. You need to set the following settings:

  • Mode - "production" value to hide error into log files
  • DbEngine, DbFile, DbHost, DbUser, DbPassword, DbName - settings of databases, for SQLite you need only to specify the rights for the folder and database file itself
  • TimeZone - time zone with the use of date and time, and also records account in Admin Panel
  • DomainName - domain name of the website, for e-mail delivery
  • MainPath - a path to the project, usually as "/" on production server