Cradle  0.3.3
Simple library for creating Web-based applications
Starter Class Reference

Web application basic functions. More...

Static Public Member Functions

static getAutoloaderFile ()
 
static getConfig ($config, $appInfo=false, $assetsFiles=null)
 
static getUriRootBack ()
 
static getRelativeLink ($link)
 
static getAssets ($assetFiles, $assetPath=null)
 
static startApp ($config)
 

Static Public Attributes

static $routerKey = 'r'
 
static $subTitleSeparator = ' | '
 
static $cookieLanguageKey = 'language'
 

Detailed Description

Web application basic functions.

Very small and simple web application core.

Version
1.0
Author
Digger mrdig.nosp@m.ger@.nosp@m.sad-s.nosp@m.yste.nosp@m.ms.ru

Member Function Documentation

static getAssets (   $assetFiles,
  $assetPath = null 
)
static

Returns array of assets obtained from assets-files.

The method loads and combines multiple arrays into one.

Parameters
array$assetFilesList of files returns array of data.
string$assetPath(option) Path to find files with data.
Returns
array Merged arrays data.
static getAutoloaderFile ( )
static

Returns a file name of currently registred autoloader

Returns
string|false Full filename or false
static getConfig (   $config,
  $appInfo = false,
  $assetsFiles = null 
)
static

Returns array of parameters loaded from $configFile and include autoloader (if it's set)

Parameters
string$configfull name of main configuration file
boolean$appInfoInclude (or not) application information (option). False by default.
string | array$assetsFiles[basename|list of basenames] of assets configuration file to include (option). Not included by default.
Returns
array
static getRelativeLink (   $link)
static

Create relative to web root link

Parameters
string$link
Returns
string
static getUriRootBack ( )
static

Gets the URI root path

Returns
string
static startApp (   $config)
static

Start web application

Very simple application router. It makes the following:

  • loads application config (and starts autoloader)
  • parse input request and define requested Controller and Action
  • include the Controller
  • define Layout file (from Controller->layout or config['layout'])
  • define View file (execute the Controller method which should return the View name, or gets the Action name if the method return nothing )
  • include Layout file. The Layout file may include the View file by call: ~~~include $contentFile;~~~

Inside the Layout and View files all configuration options are available as variables

Parameters
string | array$configFile name or array of params of application configuration.

Example:

file: index.php
//--- Application base (root) directory:
$basedir = dirname(__DIR__);
//--- Configuration file:
$configFile = $basedir . '/config/main.php';
//--- Include Starter class:
require $basedir . '/lib/digger' . '/application/Starter.php';
//--- Start application:

Field Documentation

$cookieLanguageKey = 'language'
static

Cookie language key (to determine user's selection)

$routerKey = 'r'
static

Router request key

$subTitleSeparator = ' | '
static

Sub title separator


The documentation for this class was generated from the following file: