<?php
/* Please see the README and LICENSE files. */
/**
* This models a specific file being used in the template system, for easier,
* more stable access
*/
class Template_File {
/**
* The path to the file
* Ex
* For the file
* /templates/default/foo/bar.html
* The string would be
* foo/bar
*
* @var String
*/
protected $file_path;
/**
* Set the file path to the param
* @param String $file_path
*/
public function __construct($file_path){
$this->file_path =
LIB_DIR."/".
Template_Subsystem::current_dir()."/".
Template_Subsystem::current_theme_dir()."/".
$file_path.".html";
}
/**
* Get the text from the file
* @return String
*/
public function get_text(){
if($this->exists()){ return file_get_contents($this->file_path);}
trigger_error(sprintf("Missing template file <b>%s</b>",$this->file_path),E_USER_NOTICE);
return false;
}
/**
* Ches if the currently stored file exists
* @return Boolean true if it exists
*/
public function exists(){
return file_exists($this->file_path);
}
/**
* Get the current path
* @return String
*/
public function get_name(){
return $this->file_path;
}
}
?>