It has two functions. The first function gets the URL and breaks it into parts. The second function includes the required file based on the URL parts.

public function urlParts()
{
$this->uri = $_SERVER['REQUEST_URI'];
$this->path = parse_url($this->uri, PHP_URL_PATH);

$temp_path = trim($this->path, '/');
$this->uri_parts = explode('/', $temp_path);
}

The variable $this->uri_parts[0] contains the first part of URI. This is category of article. The variable $this->uri_parts[1] is the second part of URI, which is the article of the category.

public function route()
{
// Home Page Layout
if ($this->uri_parts[0] == "")
{
$this->include = "/layout/home.php";
}

// Category Layout
else if (isset($this->uri_parts[0]))
{
$this->include = "/layout/category.php";
}
}

If the first part of URI (category) is set, then category page is included, else home page is included.

Category Page

The first part of URL is the category. It is same as the category alias or the database table name. If the second part of the URI (article) is set, then article layout is included. Otherwise, category page is rendered - title, description and link list of items in the category.