This commit is contained in:
sheychen 2017-06-20 22:10:18 +02:00
parent 61bc60a948
commit 26e9002369
3 changed files with 9 additions and 6 deletions

View File

@ -12,7 +12,7 @@
},
"autoload": {
"psr-4": {
"Krutush\\Template": "src/"
"Krutush\\Template\\": "src/"
}
}
}

View File

@ -4,6 +4,9 @@ namespace Krutush\Template;
class Html extends Text{
/** @var string */
const EXTENTION = '.phtml';
public function _escape(string $data){
return htmlspecialchars($data, ENT_QUOTES, 'UTF-8');
}

View File

@ -10,7 +10,7 @@ class Template{
/** @var array */
private $data = array();
/** @var string */
private $extention = '.tpl';
const EXTENTION = '.tpl';
public function __construct(string $path, string $extention = null, bool $folder = true){
$this->path = $this->path($path, $extention, $folder);
@ -77,7 +77,7 @@ class Template{
}
public function path(string $path, string $extention = null, bool $folder = true): string{
$path .= $extention ?? $this->extention;
$path .= $extention ?? self::EXTENTION;
if($folder == true && class_exists(\Krutush\Path)) //Remove require krutush/krutush
$path = \Krutush\Path::get('template').'/'.$path;