<?php
/**
 * Showing the page
 */

//Defining the template
$template	= new Template( $page );

//Including the template's variables
require( BASE_DIR . '/include/variables.php' );

try{

	//Defining
	$object					= SearchController::bySlug( 'news', $page->slug );

	//Defining the object to template
	$template->OBJ_NEWS		= $object;

	//Defining the news's date
	$template->NEWS_DATE	= Util::formatDate( $object->date, 'site' );

	//Defining
	$records				= ListController::notActiveOrderly( 'news', $object->id );

	//Defining the description to template
	$template->DESCRIPTION	= Util::defineDescription( $object->text );

	//Checking
	if( !is_null( $records ) )
		//Listing
		foreach( $records as $record ){

			//Defining
			$template->OBJ_OTHER_NEWS	= $record;

			//Defining the news's date
			$template->OTHER_NEWS_DATE	= Util::formatDate( $record->date, 'site' );

			//Showing
			$template->block( 'OTHER_NEWS' );

		}

}catch( Exception $e ){}

//Defining some variables
$template->BASE_URL_REPOSITORY	= BASE_URL_REPOSITORY;

//Showing the page
$template->show();