diff --git a/demo/index.php b/demo/index.php index 21a70831..a0b5ac15 100644 --- a/demo/index.php +++ b/demo/index.php @@ -4,10 +4,6 @@ require("Smarty.class.php"); $smarty = new Smarty; -$smarty->caching = false; - -$smarty->assign(now, time()); - $smarty->assign("Name","Fred Irving Johnathan Bradley Peppergill"); $smarty->assign("FirstName",array("John","Mary","James","Henry")); $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"); -function insert_foo($args) -{ - extract($args); - - return "test $arg1"; -} - ?> diff --git a/demo/templates/index.tpl b/demo/templates/index.tpl index a58809d2..dd9d0b93 100644 --- a/demo/templates/index.tpl +++ b/demo/templates/index.tpl @@ -46,7 +46,3 @@ testing strip tags {/strip} - -test: {$now|date_format:"%I:%M %p"} - -{insert name = foo arg1=5} diff --git a/docs.sgml b/docs.sgml index cb3d179b..ac282815 100644 --- a/docs.sgml +++ b/docs.sgml @@ -1361,6 +1361,15 @@ OUTPUT: </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: <select name=customer_id> @@ -1668,7 +1677,12 @@ Home Page %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 @@ -1678,6 +1692,11 @@ Home Page %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 - 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 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 - 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 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 %% - 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. diff --git a/index.php b/index.php index 21a70831..a0b5ac15 100644 --- a/index.php +++ b/index.php @@ -4,10 +4,6 @@ require("Smarty.class.php"); $smarty = new Smarty; -$smarty->caching = false; - -$smarty->assign(now, time()); - $smarty->assign("Name","Fred Irving Johnathan Bradley Peppergill"); $smarty->assign("FirstName",array("John","Mary","James","Henry")); $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"); -function insert_foo($args) -{ - extract($args); - - return "test $arg1"; -} - ?> diff --git a/templates/index.tpl b/templates/index.tpl index a58809d2..dd9d0b93 100644 --- a/templates/index.tpl +++ b/templates/index.tpl @@ -46,7 +46,3 @@ testing strip tags {/strip} - -test: {$now|date_format:"%I:%M %p"} - -{insert name = foo arg1=5}