Пример #1
0
 /**
  * Initializes the app.
  */
 public static function Init()
 {
     if (!class_exists('\\Nemiro\\Server')) {
         \Nemiro\App::IncludeFile('Server.php');
         new \Nemiro\Server();
     }
     if (!class_exists('\\Nemiro\\Text')) {
         \Nemiro\App::IncludeFile('Text.php');
     }
     if (!class_exists('\\Nemiro\\Console')) {
         \Nemiro\App::IncludeFile('Console.php');
     }
     if (!class_exists('\\Nemiro\\UI\\Page')) {
         \Nemiro\App::IncludeFile('~/Nemiro/UI');
     }
 }
Пример #2
0
require_once 'config.php';
# app.php from the WebForms.PHP
require_once $_SERVER['DOCUMENT_ROOT'] . '\\Nemiro\\App.php';
# import and init application class
use Nemiro\App;
App::Init();
# set event handlers
App::AddHandler('Application_BeginRequest');
# you are not required to use all the handlers
# App::AddHandler('Application_EndRequest');
# App::AddHandler('Application_IncludedFile');
App::AddHandler('Application_Error');
# you can use custom handler names
App::AddHandler('Session_Start', 'MyHandler');
# include files from folder using Import.php
App::IncludeFile('~/Nemiro/Collections');
# include database clients
# get from https://github.com/alekseynemiro/Nemiro.Data.PHP
# App::IncludeFile('~/Nemiro/Data');
# include your modules
# App::IncludeFile('~/user.php');
# App::IncludeFile('~/your/path/here.php');
# application event handlers
function Application_BeginRequest()
{
    # echo 'Processing...';
}
# function Application_IncludedFile($path)
# {
#		echo sprintf('Included: %s', $path);
# }