various things

This commit is contained in:
didou
2004-03-28 19:15:35 +00:00
parent ebbdfe66d1
commit b60da80b37
3 changed files with 28 additions and 19 deletions

View File

@@ -3,8 +3,8 @@
<chapter id="bugs"> <chapter id="bugs">
<title>BUGS</title> <title>BUGS</title>
<para> <para>
Check the BUGS file that comes with the latest distribution of Smarty, or Check the <filename>BUGS</filename> file that comes with
check the website. the latest distribution of Smarty, or check the website.
</para> </para>
</chapter> </chapter>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
@@ -26,4 +26,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml vim: et tw=78 syn=sgml
vi: ts=1 sw=1 vi: ts=1 sw=1
--> -->

View File

@@ -120,10 +120,12 @@ footer.tpl
control over date formatting, and also makes it easy to compare dates if control over date formatting, and also makes it easy to compare dates if
necessary. necessary.
</para> </para>
<para> <note>
NOTE: As of Smarty 1.4.0, you can pass dates to Smarty as unix <para>
timestamps, mysql timestamps, or any date parsable by strtotime(). As of Smarty 1.4.0, you can pass dates to Smarty as unix
</para> timestamps, mysql timestamps, or any date parsable by strtotime().
</para>
</note>
<example> <example>
<title>using date_format</title> <title>using date_format</title>
<programlisting> <programlisting>
@@ -160,18 +162,21 @@ OUTPUT:
// this assumes your form elements are named // this assumes your form elements are named
// startDate_Day, startDate_Month, startDate_Year // startDate_Day, startDate_Month, startDate_Year
$startDate = makeTimeStamp($startDate_Year,$startDate_Month,$startDate_Day); $startDate = makeTimeStamp($startDate_Year, $startDate_Month, $startDate_Day);
function makeTimeStamp($year="",$month="",$day="") function makeTimeStamp($year="", $month="", $day="")
{ {
if(empty($year)) if(empty($year)) {
$year = strftime("%Y"); $year = strftime("%Y");
if(empty($month)) }
if(empty($month)) {
$month = strftime("%m"); $month = strftime("%m");
if(empty($day)) }
if(empty($day)) {
$day = strftime("%d"); $day = strftime("%d");
}
return mktime(0,0,0,$month,$day,$year); return mktime(0, 0, 0, $month, $day, $year);
} }
]]> ]]>
</programlisting> </programlisting>
@@ -195,10 +200,12 @@ function makeTimeStamp($year="",$month="",$day="")
// be sure apache is configure for the .wml extensions! // be sure apache is configure for the .wml extensions!
// put this function somewhere in your application, or in Smarty.addons.php // put this function somewhere in your application, or in Smarty.addons.php
function insert_header($params) { function insert_header($params)
{
// this function expects $content argument // this function expects $content argument
if(empty($params['content'])) if (empty($params['content'])) {
return; return;
}
header($params['content']); header($params['content']);
return; return;
} }
@@ -265,18 +272,20 @@ Pretty easy isn't it?
// drop file "function.load_ticker.php" in plugin directory // drop file "function.load_ticker.php" in plugin directory
// setup our function for fetching stock data // setup our function for fetching stock data
function fetch_ticker($symbol) { function fetch_ticker($symbol)
{
// put logic here that fetches $ticker_info // put logic here that fetches $ticker_info
// from some ticker resource // from some ticker resource
return $ticker_info; return $ticker_info;
} }
function smarty_function_load_ticker($params, &$smarty) { function smarty_function_load_ticker($params, &$smarty)
{
// call the function // call the function
$ticker_info = fetch_ticker($params['symbol']); $ticker_info = fetch_ticker($params['symbol']);
// assign template variable // assign template variable
$smarty->assign($params['assign'],$ticker_info); $smarty->assign($params['assign'], $ticker_info);
} }
?> ?>
]]> ]]>

View File

@@ -74,4 +74,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml vim: et tw=78 syn=sgml
vi: ts=1 sw=1 vi: ts=1 sw=1
--> -->