Location: PHPKode > projects > DIY Blog > diy-blog/classes/diy-blog/frontend/controller/FrontEndController.class.php
<?php

/**
 * Handles requests to the backend application.
 * @package diy-blog.frontend.controller
 * @author	Martynas Jusevicius <hide@address.com>
 * @link	http://www.xml.lt
 */

class FrontEndController extends Controller
{
	private static $instance = null;

	private function __construct() {}
	private function __clone() {}

	public static function getInstance()
	{
		if (self::$instance == null) self::$instance = new self();
		return self::$instance;
	}

	public function process(Request $request, Response $response, ResourceMapping $mapping)
	{
		try
		{
			parent::process($request, $response, $mapping);

			if ($this->resource == null) $this->view = new NotFoundView(null);

			if ($this->view != null) $this->view->display($request, $response);
			$this->output($response);
		}
		catch (Exception $e)
		{
			//print $e->getMessage();
			$this->view = new ErrorView(null);
			$request->setAttribute("error-message", $e->getMessage());
			$this->view->display($request, $response);
			$this->output($response);
		}

	}

}

?>
Return current item: DIY Blog