<?php 
// namespace core;
// use helpers\session as Session;
// use helpers\language as Language;

/**
* View - loads template pages ("renders")
*/
class View{

	/**
	* Include the template file for view rendering
	* @param string $path path to file from views folder
	* @param array $data array of data
	* @param array $error array of errors
	*/
	public function renderPath($path,$data = false, $error = false){
		/* Get the language translations for current rendering */
		$lang = Language::getArray();
		require_once "$path.php";
	}

	/**
	* Include the template file for view rendering
	* @param string $path path to file from views folder
	* @param array $data array of data
	* @param array $error array of errors
	*/
	public function render($path,$data = false, $error = false){
		/* Get the language translations for current rendering */
		$lang = Language::getArray();
		require_once "views/$path.php";
	}

	/**
	* Renders the absolute path to selected template directory
	* @param string $path path to file from templates folder
	* @param array $data array of data
	*/
	public function rendertemplate($path,$data = false){
		/* Get the language translations for current rendering */
		$lang = Language::getArray();
		require_once "templates/".Session::get('template')."/$path.php";
	}

	/**
	* Returns the absolute path to custom or predefined template directory
	* @param string $tmpl path to directory from templates folder
	* @param string $path path to file from templates folder
	* @param array $data array of data
	*/
	public function rendercusttmpl($tmpl='orn',$path,$data = false){
		/* Get the language translations for current rendering */
		$lang = Language::getArray();
		require_once "templates/$tmpl/$path.php";
	}
}