<?php
/*!
* \mainpage eSolution4 Developer Guide
*
* \section architecture_sec Architecture
* eSolution4 is comprised of several 'controllers', 'views', 'templates', and 'site models'.
*
* \section template_sec Template
* A template, is used by a controller to render the entire page. A single template can be used for an entire site. 
* Each controller can be configured to use a different site template. The site template defines the site layout, 
* specifically if a header, footer, left sidebar, and right sidebar exist. 
* 
* Several special templates exist, these are TemplateJson, TemplateXml, and TemplateNoheaders.
*
* Templates are always located in /eSolution_config/templates/. The default site template is always named Template.php, 
* named templates are called TemplateMytemplate.php. This naming convention is required for eSolution to find and load 
* the template.
*
* \section site_model_sec Site Model
* A site model is used to provide the template HTML to render. The template requests html for each of it's areas, such 
* as header and footer. The site model determines what the header will look like and provides the HTML to the template. 
* A site model will use controllers and views to generate the necessary HTML.
*
* Site Models are always located in /eSolution_config/models/. The default site model is always named Model.php, named 
* models are called ModelMymodel.php. This naming convention is required for eSolution to find and load the model. It 
* is recommended to only use one Model per site unless the site is very large serving multiple business units.
*
* \section controller_sec Controller
* A controller performs a specific function for your web site, an example is the 'basket' controller that lists, adds, 
* updates, and removes items from your shopping cart. Each controller uses a template to define how the web site appears. 
*
* The controller uses a view to determine the appearance of the main portion of the page.
*
* Controllers are the core of eSolution4 and are located in several locations. Here is a complete list of all eSolution4 
* controllers and their function. 
*
* \section model_sec Model
* A model is used by a view to get data. Examples are the Catalogue and Item model, these models retrieve data from the 
* databases and expose the data to the view. The view renders the data. Models do not follow any paticular naming 
* convention. Models are located in class. Database models are located in class/database/
*
* \section view_sec View
* A single view must exist for each controller. The view determines the appearance of the controller. An example is the 
* basket, the controller provides all of the basket data to the view, and the view determines that it should be displayed 
* in a table. Multiple views for a single controller can exist and be used to render the controller in different ways 
* throughout the site. A common example is creating a compact shopping card in the right sidebar of the page. This feature 
* would use an alternate view than the main basket page would use.
*
* Views are always located in /eSolution_config/views/. The default view for a controller is always named after the controller, 
* for example BasketView.php, named views are called BasketViewSidebar.php. This naming convention is required for eSolution 
* to find and load the view.
 */

include($_SERVER["DOCUMENT_ROOT"]."/eSolution_config/config/eSolution.conf.php");
$root = EsolutionConfig::$esolution_root;
$pwd = __DIR__;
if(realpath($root) !== realpath($pwd)) {
    die('eSolution Configuration Error: Please contact support.');
}
include(EsolutionConfig::$esolution_root."/include/bootstrap.php");

$url = "";
if( isset( $_SERVER['REDIRECT_URL'] ) ) $url = $_SERVER['REDIRECT_URL'];

$router = new EsolutionRouter($url);
echo $router->route();
