From 9b8a50224bd9ebd1f37e7cf969d61e4a8edd0417 Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Thu, 29 Sep 2011 22:55:15 +0200 Subject: ste:date now uses strftime Because strftime is more flexible: You can... * ...put arbitrary text inside the format * ...manipulate it by set the locale (i.e. set language-specific month names etc.) --- docu/language_definition.html | 4 ++-- example/templates/src/articles.html | 2 +- stupid_template_engine.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docu/language_definition.html b/docu/language_definition.html index f4bbf52..c0f853b 100644 --- a/docu/language_definition.html +++ b/docu/language_definition.html @@ -538,10 +538,10 @@

Decrements (i.e. substract 1) a variable (variable name given by parameter var).

ste:date

-

Formats a time using PHPs date format [ext. Link]. The format is given in the tag's content. You can specify a time (unix timestamp) using the timestamp parameter (defaults to the current time).

+

Formats a time using PHPs strftime format [ext. Link]. The format is given in the tag's content. You can specify a time (unix timestamp) using the timestamp parameter (defaults to the current time).

Example:
-

d. M. Y, H:i:s]]>
+
%d. %h. %Y, %H:%M:%S]]>
Result:

diff --git a/example/templates/src/articles.html b/example/templates/src/articles.html index c0db692..108a3b8 100644 --- a/example/templates/src/articles.html +++ b/example/templates/src/articles.html @@ -6,7 +6,7 @@

$article[title]

Author: $article[author]
-
d. M. Y, H:i:s
+
%d. %h. %Y, %H:%M:%S
diff --git a/stupid_template_engine.php b/stupid_template_engine.php index 2be4f79..860067b 100644 --- a/stupid_template_engine.php +++ b/stupid_template_engine.php @@ -1282,7 +1282,7 @@ class STEStandardLibrary static public function date($ste, $params, $sub) { - return @date($sub($ste), empty($params["timestamp"]) ? @time() : (int) $params["timestamp"]); + return @strftime($sub($ste), empty($params["timestamp"]) ? @time() : (int) $params["timestamp"]); } } -- cgit v1.2.3-70-g09d2