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

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

//Defining the meta
$meta		= ( defined( 'METADATA_BLOG' ) ) ? METADATA_BLOG : null;

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

//News
try{

	//Defining
	$records	= ListController::orderly( 'news', 'date-desc' );

	//Listing
	foreach( $records as $i => $record ){

		//Checking
		if( $i < 3 ){

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

			//Defining the date to template
			$template->NEWS_FEATURED_DATE	= Util::formatDate( $record->date, 'site' );

			//Showing the block
			$template->block( 'FEATURED' );

		}else{

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

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

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

		}

	}

}catch( Exception $e ){

	//Redirecting
	header( 'Location:' . BASE_URL );

}

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

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