Login   Register  
PHP Classes
elePHPant
Icontem

File: code/includes/starter.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Junaid Hassan  >  PHP MVC  >  code/includes/starter.php  >  Download  
File: code/includes/starter.php
Role: Application script
Content type: text/plain
Description: starter.php
Class: PHP MVC
MVC framework that loads XML configuration files
Author: By
Last change:
Date: 2013-04-27 07:16
Size: 1,992 bytes
 

Contents

Class file image Download
<?php

/* File name        : starter.php
 * Created by       : Junaid Hassan (email : junaidhassanalvi@gmail.com , blog : junaidhassanalvi.wordpress.com)
 * Created On       : 14-April-2103
 * Description      : It is trigger to start process for website. 
 * 
 * Change Logs      : 15-April -- add url class object to catalog
 *                    16-April -- add database and other classes objects to catalog
 * 
 */


//jha-- load configuration from config.xml and append some php configuration
include('configuration.php');
$configuration = new Configuration();

//jha-- load classes and helper required by the applicaiton
$configuration->preload();

//jha-- catalog is going to have all assets of the website and provide them in inherited controller
$catalog = new Catalog();
$catalog->set('configuration'$configuration);
$catalog->set('config'$configuration->config);

//jha-- create utilities object and assign to catalog
$utilities = new Utilities($catalog);
$catalog->set('utilities'$utilities);

//jha-- create utilities object and assign to catalog
$url = new Url($catalog);
$catalog->set('url'$url);

//jha-- parse url to find out controller and action, to route request to appropriate controller and action
$url->parse_current();

//jha-- create loader object and assign to catalog
$loader = new Loader($catalog);
$catalog->set('loader'$loader);

//jha-- create database object and assign to catalog
$database = new Database($catalog);
$catalog->set('database'$database);

//jha-- create object of required controller and assign catalog
$obj = new $url->controller_class($catalog);

if (
is_array($url->qParams))
    if (
count($url->qParams) > 0)
        
$parms $url->qParams;
    else
        
$parms = array();
else
    
$parms = array();

//jha-- call appropriate method from appropriate class by appropriate passing parameters
call_user_func_array(array($obj$url->controller_action), $parms);

?>