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

Debugging

Debug class

In MV there is a class "Debug" containing some methods for debugging the written code. The "pre()" method displays a dump of variable. With its help it is convenient to view the content of arrays and objects. The "echo" function is not required for this.

Debug :: pre($var);
Debug :: pre($mv -> pages);

Log files

Log class can create files in folder "log" at the root of the project. This folder must have right allowing to write into folder.

//Creates new record in log file named like current server, for example mysite.com.log
Log :: add("Error or message text");

//Creates new record in log file with passed name, for example events.log
Log :: add("Error or message text", "events");

Generation time and count of SQL queries

There is a parameter in "index.php" file that makes it possible to see page generation time, number of called queries, and also the included template file. For this you need to pass 1 (by default, 0) as a parameter when creating "$debug" object. After page reload, you can see the list of information about this page in the end.

<?
require_once "config/autoload.php";

$debug = new Debug(1);
...
?>

Detection of browser type

The browser of the user can be detected by a static "browser()" method of the class "Debug". Returns a browser type, possible value are "firefox", "ie", "opera", "chrome", "safari", "edge" or "false" if not in the list of these types.

$browser = Debug :: browser();

if($browser == "chrome")
{
   ...
}

Detection of mobile device

The following mobile devices can be detected: Android, iPhone, iPod, BlackBerry, IEMobile, Windows Phone. Returned values are: "android", "iphone", "ipod", "blackberry", "ie", "windows" or "false" if not in the list of these types.

if(Debug :: isMobile() == "android") 
    include ...;

if(Debug :: isMobile()) //Any smartphone
{ 
    ... 
}

Detection of tablet device

The following tablet devices can be detected: Android, iPad, Windows. Returned values are: "android", "ipad", "windows" or "false" if not in the list of these types.

if(Debug :: isTablet() == "ipad")
    include ...;

if(Debug :: isTablet()) //Any tablet
{
    ...
}

Previous section

Security

Next section

General principles of plugins

© 2012-2023, MV framework

MV tracker is based on open source MV framework
License