MVC bad dispaching
Someone pls help, i just stuck in my tiny mvc project.
I have in BOOTSTRAP.php

    <?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

	require_once dirname(__FILE__).DS.'Loader'.EXT;
	require_once dirname(__FILE__).DS.'Controller'.EXT;

	function __autoload($ClassName)
	{
		$file = APPPATH.DS.'controllers'.DS.$ClassName.EXT;
		require_once $file;
	}
	
	$uri = strtolower($_SERVER['REQUEST_URI']);
	$uri = explode('/', $uri);
	$controller = $uri[1];
	if ($controller == '') 
		{
			$controller = 'welcome';
		}

	$ControllerName = ucfirst($controller);

	if (empty($uri[2])) 
	{
		$ActionName = 'index';
	}
	else
	{
		$ActionName = $uri[2];
	}
	$Controller = new $ControllerName($ControllerName, $ActionName);

In my controller.php i have:

        <?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    
    class Controller 
    {
    	protected $load;
    	protected $ActionName;
    	protected $ControllerName;
    
    	public function __construct($ControllerName, $ActionName)
    	{
    		$this->load = new Loader();
    		$this->ControllerName = $ControllerName;
    		$this->ActionName = $ActionName;
    		$this->dispatch();
    	}
    
    	public function dispatch()
    	{
    		$method = $this->ActionName;
    		$controller = $this->ControllerName;
    		$controller = new $controller;
    		if (method_exists($controller, $method)) 
    		{
    			$this->method();
    		}
    		else
    		{
    			echo "Please implement function caled $method";
    		}
    	}
    }

And finaly in welcome controller i have:

  

      <?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    class Welcome extends Controller
    {
    	public function __construct()
    	{
    		parent:: __construct();
    	}
    
    	public function index()
    	{
    		$data = array(
    						'fname' 	=> 'Stefan',
    						'lname' 	=> 'Cvetkovic',
    						'country' 	=> 'Serbia',
    					);
    		$this->load->view('welcome', $data);	
    	}
    }

When i call in bootstrap

    $Controller = new $ControllerName($ControllerName, $ActionName);

i got:

    Missing argument 1 for Controller::__construct()
    Missing argument 2 for Controller::__construct()
    Undefined variable: ControllerName
    Undefined variable: ActionName
    Class name must be a valid object or a string

Someone pls help i miss something, couse i'm new in OOP.

MVC bad dispaching
===

Someone pls help, i just stuck in my tiny mvc project.
I have in BOOTSTRAP.php

    <?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

	require_once dirname(__FILE__).DS.'Loader'.EXT;
	require_once dirname(__FILE__).DS.'Controller'.EXT;

	function __autoload($ClassName)
	{
		$file = APPPATH.DS.'controllers'.DS.$ClassName.EXT;
		require_once $file;
	}
	
	$uri = strtolower($_SERVER['REQUEST_URI']);
	$uri = explode('/', $uri);
	$controller = $uri[1];
	if ($controller == '') 
		{
			$controller = 'welcome';
		}

	$ControllerName = ucfirst($controller);

	if (empty($uri[2])) 
	{
		$ActionName = 'index';
	}
	else
	{
		$ActionName = $uri[2];
	}
	$Controller = new $ControllerName($ControllerName, $ActionName);

In my controller.php i have:

        <?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    
    class Controller 
    {
    	protected $load;
    	protected $ActionName;
    	protected $ControllerName;
    
    	public function __construct($ControllerName, $ActionName)
    	{
    		$this->load = new Loader();
    		$this->ControllerName = $ControllerName;
    		$this->ActionName = $ActionName;
    		$this->dispatch();
    	}
    
    	public function dispatch()
    	{
    		$method = $this->ActionName;
    		$controller = $this->ControllerName;
    		$controller = new $controller;
    		if (method_exists($controller, $method)) 
    		{
    			$this->method();
    		}
    		else
    		{
    			echo "Please implement function caled $method";
    		}
    	}
    }

And finaly in welcome controller i have:

  

      <?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    class Welcome extends Controller
    {
    	public function __construct()
    	{
    		parent:: __construct();
    	}
    
    	public function index()
    	{
    		$data = array(
    						'fname' 	=> 'Stefan',
    						'lname' 	=> 'Cvetkovic',
    						'country' 	=> 'Serbia',
    					);
    		$this->load->view('welcome', $data);	
    	}
    }

When i call in bootstrap

    $Controller = new $ControllerName($ControllerName, $ActionName);

i got:

    Missing argument 1 for Controller::__construct()
    Missing argument 2 for Controller::__construct()
    Undefined variable: ControllerName
    Undefined variable: ActionName
    Class name must be a valid object or a string

Someone pls help i miss something, couse i'm new in OOP.
