MV framework logo
  • Architecture
    • Philosophy
    • Technologies
  • Admin Panel
  • Changelog
  • Support
  • Feedback
Download Version 2.6 from 07.10.2022
Documentation
  • Architecture
    • Philosophy
    • Technologies
  • Admin Panel
  • Changelog
  • Support
  • Feedback
Getting started
  • Installation and launch
  • System folders
  • Launch of simple website
  • Pre-installed models
  • System settings
Models
  • General principles of models
  • Data types
  • Model settings
  • Simple models
  • Foreign keys
  • Trees
  • Many to many
  • Group
  • Records management
  • Simple model management
  • Additional options
Views and routes
  • General principles of views
  • Router object
  • MV object
  • Index, default and 404 templates
  • Creating a new template
  • Data display in template
  • Object of Record class
  • Files and images
  • Date and time
  • Redirects
  • Email delivery
  • Special methods
Forms
  • Forms creation
  • Form fields settings
  • Form validation rules
  • Form validation process
  • Operations with form data
  • Using data from models
  • Form methods
SQL queries
  • Query constructor
  • Direct queries
  • Pagination
  • Sorting
  • Filtration
  • Upload from CSV files
Sessions and security
  • Work with sessions
  • AJAX
  • Security
  • Debugging
Plugins
  • General principles of plugins
  • Additions to admin panel
  • Caching
Documentation
Getting started
  • Installation and launch
  • System folders
  • Launch of simple website
  • Pre-installed models
  • System settings
Models
  • General principles of models
  • Data types
  • Model settings
  • Simple models
  • Foreign keys
  • Trees
  • Many to many
  • Group
  • Records management
  • Simple model management
  • Additional options
Views and routes
  • General principles of views
  • Router object
  • MV object
  • Index, default and 404 templates
  • Creating a new template
  • Data display in template
  • Object of Record class
  • Files and images
  • Date and time
  • Redirects
  • Email delivery
  • Special methods
Forms
  • Forms creation
  • Form fields settings
  • Form validation rules
  • Form validation process
  • Operations with form data
  • Using data from models
  • Form methods
SQL queries
  • Query constructor
  • Direct queries
  • Pagination
  • Sorting
  • Filtration
  • Upload from CSV files
Sessions and security
  • Work with sessions
  • AJAX
  • Security
  • Debugging
Plugins
  • General principles of plugins
  • Additions to admin panel
  • Caching

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

Previous section

Pre-installed models

Next section

General principles of models

© 2012-2023, MV framework

MV tracker is based on open source MV framework
License