phplibrary/src/tales.php
2017-02-09 14:57:40 +03:00

34 lines
900 B
PHP

<?php
/**
* Расширения для PHPTAL для отображения времени и даты
* package utils
*/
class DateTime_Tales implements PHPTAL_Tales
{
static public function date ($expression, $nothrow = false)
{
return "phptal_date(".PHPTAL_TalesInternal::path ($expression).")";
}
static public function time ($expression, $nothrow = false)
{
return "phptal_time(".PHPTAL_TalesInternal::path ($expression).")";
}
}
/* Регистрация нового префикса для подключения компонента */
$registry = PHPTAL_TalesRegistry::getInstance();
$registry->registerPrefix('date', array('DateTime_Tales', 'date'));
$registry->registerPrefix('time', array('DateTime_Tales', 'time'));
function phptal_date ($e)
{
return date ("d.m.Y", $e);
}
function phptal_time ($e)
{
return date ("H:i", $e);
}