/**
	 * Singleton's pattern
	 *
	 * @access public static	 
	 * @return SLS_FrontController $instance the self reference
	 * @since 1.0
	 */
	public static function getInstance()
	{
		if (is_null(self::$_instance)) {
			self::$_instance = new SLS_FrontController();
		}
		return self::$_instance;
	}
	/**
	 * Dispatch the controller and the action without reloading the application	 
	 *
	 * @access public
	 * @param string $controller generic controller name
	 * @param string $action generic scontroller name	 
	 * @param array $http set new params for $_GET and $_POST
	 * <code>
	 * array(
	 * 		"POST" 	=> array("key" => "value"), 
	 * 		"GET" 	=> array("key" => "value")
	 * )
	 * </code>	 
	 * @see SLS_Generic::redirect
	 * @see SLS_Generic::goDirectTo
	 * @see SLS_Generic::getFullPath
	 * @see SLS_Generic::getFullUrl
	 * @see SLS_Generic::getTranslatedController
	 * @see SLS_Generic::redirectOnPreviousPage
	 * @since 1.0
	 * @example 
	 * $this->_generic->dispatch("Home","Index");
	 */
	public function dispatch($controller,$action,$http=array("POST"=>array(),"GET"=>array()))
	{
		SLS_FrontController::getInstance($this)->dispatch($controller,$action,$http);
	}
Example #3
0
<?php

include "Sls/Generics/SLS_Generic.class.php";
$genericLib = SLS_Generic::getInstance()->loadFramework();
$frontController = SLS_FrontController::getInstance($genericLib);
$frontController->loadController();
new SLS_View($genericLib, $frontController->getXML());