mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 02:44:27 +02:00
various things
This commit is contained in:
@@ -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
|
||||||
|
@@ -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>
|
||||||
|
<note>
|
||||||
<para>
|
<para>
|
||||||
NOTE: As of Smarty 1.4.0, you can pass dates to Smarty as unix
|
As of Smarty 1.4.0, you can pass dates to Smarty as unix
|
||||||
timestamps, mysql timestamps, or any date parsable by strtotime().
|
timestamps, mysql timestamps, or any date parsable by strtotime().
|
||||||
</para>
|
</para>
|
||||||
|
</note>
|
||||||
<example>
|
<example>
|
||||||
<title>using date_format</title>
|
<title>using date_format</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
@@ -164,12 +166,15 @@ $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);
|
||||||
}
|
}
|
||||||
@@ -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,13 +272,15 @@ 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']);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user