<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
// +----------------------------------------------------------------------+
// | File name : bootstrap.php                                            |
// | PHP version >= 5.2                                                   |
// +----------------------------------------------------------------------+
// | Author: BINU CHANDRAN.E<binu.chandran@armiasystems.com>              |
// +----------------------------------------------------------------------+
// | Copyrights Armia Systems � 2010                                      |
// | All rights reserved                                                  |
// +----------------------------------------------------------------------+
// | This script may not be distributed, sold, given away for free to     |
// | third party, or used as a part of any internet services such as      |
// | webdesign etc.                                                       |
// +----------------------------------------------------------------------+
class ConfigBootstrap
{
	/**
	* Execution will start here
	**/
	public function run()
	{
       
        //Controller class name
        $controllerClassName = 'Controller' . ucfirst(CONTROLLER);         

        
        //Create controller object
        $controller = new $controllerClassName;
       
        //Initialize controller
        $controller->init();
        //Set view folder and file name
        $controller->setRender(strtolower(CONTROLLER), strtolower(METHOD));
        //Function name
        $method = METHOD;
        
        
        //Call function from action
        $evalString = '$controller->' . $method . '('.ARGS.');';

       
        if(method_exists($controller, $method)) {
            eval($evalString);
        } else {
            ob_start();
            header('location:' . BASE_URL . 'error' );
            exit;
        }
       PageContext::registerMetaData();
        //Render Layout and action view     echo 'hi';exit;   
        $controller->renderLayout();
        
	}
}