mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 11:24:27 +02:00
upated docs for date_format and html_options
This commit is contained in:
@@ -4,10 +4,6 @@ require("Smarty.class.php");
|
|||||||
|
|
||||||
$smarty = new Smarty;
|
$smarty = new Smarty;
|
||||||
|
|
||||||
$smarty->caching = false;
|
|
||||||
|
|
||||||
$smarty->assign(now, time());
|
|
||||||
|
|
||||||
$smarty->assign("Name","Fred Irving Johnathan Bradley Peppergill");
|
$smarty->assign("Name","Fred Irving Johnathan Bradley Peppergill");
|
||||||
$smarty->assign("FirstName",array("John","Mary","James","Henry"));
|
$smarty->assign("FirstName",array("John","Mary","James","Henry"));
|
||||||
$smarty->assign("LastName",array("Doe","Smith","Johnson","Case"));
|
$smarty->assign("LastName",array("Doe","Smith","Johnson","Case"));
|
||||||
@@ -19,11 +15,4 @@ $smarty->assign("contacts", array(array("phone" => "1", "fax" => "2", "cell" =>
|
|||||||
|
|
||||||
$smarty->display("index.tpl");
|
$smarty->display("index.tpl");
|
||||||
|
|
||||||
function insert_foo($args)
|
|
||||||
{
|
|
||||||
extract($args);
|
|
||||||
|
|
||||||
return "test $arg1";
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@@ -46,7 +46,3 @@ testing strip tags
|
|||||||
{/strip}
|
{/strip}
|
||||||
|
|
||||||
</PRE>
|
</PRE>
|
||||||
|
|
||||||
test: {$now|date_format:"%I:%M %p"}
|
|
||||||
|
|
||||||
{insert name = foo arg1=5}
|
|
||||||
|
31
docs.sgml
31
docs.sgml
@@ -1361,6 +1361,15 @@ OUTPUT:
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
{* an alternative method is to pass the values & output as an associative array into
|
||||||
|
options. $customer_options is an associative array in this example. This
|
||||||
|
functionality was added to Smarty 1.3.0 *}
|
||||||
|
|
||||||
|
<select name=customer_id>
|
||||||
|
{html_options options=$customer_options selected=$customer_id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
OUTPUT:
|
OUTPUT:
|
||||||
|
|
||||||
<select name=customer_id>
|
<select name=customer_id>
|
||||||
@@ -1668,7 +1677,12 @@ Home Page
|
|||||||
|
|
||||||
%D - same as %m/%d/%y
|
%D - same as %m/%d/%y
|
||||||
|
|
||||||
%e - day of the month as a decimal number, a single digit is preceded by a space (range ' 1' to '31')
|
%e - day of the month as a decimal number, a single digit is preceded by a
|
||||||
|
space (range 1 to 31)
|
||||||
|
|
||||||
|
%g - Week-based year within century [00,99]
|
||||||
|
|
||||||
|
%G - Week-based year, including the century [0000,9999]
|
||||||
|
|
||||||
%h - same as %b
|
%h - same as %b
|
||||||
|
|
||||||
@@ -1678,6 +1692,11 @@ Home Page
|
|||||||
|
|
||||||
%j - day of the year as a decimal number (range 001 to 366)
|
%j - day of the year as a decimal number (range 001 to 366)
|
||||||
|
|
||||||
|
%k - Hour (24-hour clock) single digits are preceded by a blank. (range 0 to 23)
|
||||||
|
|
||||||
|
%l - hour as a decimal number using a 12-hour clock, single digits preceeded by
|
||||||
|
a space (range 1 to 12)
|
||||||
|
|
||||||
%m - month as a decimal number (range 01 to 12)
|
%m - month as a decimal number (range 01 to 12)
|
||||||
|
|
||||||
%M - minute as a decimal number
|
%M - minute as a decimal number
|
||||||
@@ -1703,10 +1722,10 @@ Home Page
|
|||||||
%V - The ISO 8601:1988 week number of the current year as a decimal number, range 01 to 53, where week 1
|
%V - The ISO 8601:1988 week number of the current year as a decimal number, range 01 to 53, where week 1
|
||||||
is the first week that has at least 4 days in the current year, and with Monday as the first day of the week.
|
is the first week that has at least 4 days in the current year, and with Monday as the first day of the week.
|
||||||
|
|
||||||
%W - week number of the current year as a decimal number, starting with the first Monday as the first day of the first week
|
|
||||||
|
|
||||||
%w - day of the week as a decimal, Sunday being 0
|
%w - day of the week as a decimal, Sunday being 0
|
||||||
|
|
||||||
|
%W - week number of the current year as a decimal number, starting with the first Monday as the first day of the first week
|
||||||
|
|
||||||
%x - preferred date representation for the current locale without the time
|
%x - preferred date representation for the current locale without the time
|
||||||
|
|
||||||
%X - preferred time representation for the current locale without the date
|
%X - preferred time representation for the current locale without the date
|
||||||
@@ -1718,6 +1737,12 @@ is the first week that has at least 4 days in the current year, and with Monday
|
|||||||
%Z - time zone or name or abbreviation
|
%Z - time zone or name or abbreviation
|
||||||
|
|
||||||
%% - a literal `%' character
|
%% - a literal `%' character
|
||||||
|
|
||||||
|
|
||||||
|
PROGRAMMERS NOTE: date_format is a wrapper to PHP's strftime() function. You
|
||||||
|
may have more or less conversion specifiers available depending on your
|
||||||
|
system's strftime() function where PHP was compiled. Check your system's manpage
|
||||||
|
for a full list of valid specifiers.
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
|
11
index.php
11
index.php
@@ -4,10 +4,6 @@ require("Smarty.class.php");
|
|||||||
|
|
||||||
$smarty = new Smarty;
|
$smarty = new Smarty;
|
||||||
|
|
||||||
$smarty->caching = false;
|
|
||||||
|
|
||||||
$smarty->assign(now, time());
|
|
||||||
|
|
||||||
$smarty->assign("Name","Fred Irving Johnathan Bradley Peppergill");
|
$smarty->assign("Name","Fred Irving Johnathan Bradley Peppergill");
|
||||||
$smarty->assign("FirstName",array("John","Mary","James","Henry"));
|
$smarty->assign("FirstName",array("John","Mary","James","Henry"));
|
||||||
$smarty->assign("LastName",array("Doe","Smith","Johnson","Case"));
|
$smarty->assign("LastName",array("Doe","Smith","Johnson","Case"));
|
||||||
@@ -19,11 +15,4 @@ $smarty->assign("contacts", array(array("phone" => "1", "fax" => "2", "cell" =>
|
|||||||
|
|
||||||
$smarty->display("index.tpl");
|
$smarty->display("index.tpl");
|
||||||
|
|
||||||
function insert_foo($args)
|
|
||||||
{
|
|
||||||
extract($args);
|
|
||||||
|
|
||||||
return "test $arg1";
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@@ -46,7 +46,3 @@ testing strip tags
|
|||||||
{/strip}
|
{/strip}
|
||||||
|
|
||||||
</PRE>
|
</PRE>
|
||||||
|
|
||||||
test: {$now|date_format:"%I:%M %p"}
|
|
||||||
|
|
||||||
{insert name = foo arg1=5}
|
|
||||||
|
Reference in New Issue
Block a user