mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 10:54:27 +02:00
add PHP tags to get syntax colorized and correct the problem
# http://didou.keliglia.com/php/livedocs-smarty/index.php?l=en&q=tips
This commit is contained in:
@@ -8,13 +8,13 @@
|
|||||||
<title>Blank Variable Handling</title>
|
<title>Blank Variable Handling</title>
|
||||||
<para>
|
<para>
|
||||||
There may be times when you want to print a default value for an empty
|
There may be times when you want to print a default value for an empty
|
||||||
variable instead of printing nothing, such as printing " " so that
|
variable instead of printing nothing, such as printing "&nbsp;" so that
|
||||||
table backgrounds work properly. Many would use an {if} statement to
|
table backgrounds work properly. Many would use an {if} statement to
|
||||||
handle this, but there is a shorthand way with Smarty, using the
|
handle this, but there is a shorthand way with Smarty, using the
|
||||||
<emphasis>default</emphasis> variable modifier.
|
<emphasis>default</emphasis> variable modifier.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>Printing when a variable is empty</title>
|
<title>Printing &nbsp; when a variable is empty</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{* the long way *}
|
{* the long way *}
|
||||||
@@ -171,6 +171,8 @@ Jan 4, 2001
|
|||||||
<title>converting form date elements back to a timestamp</title>
|
<title>converting form date elements back to a timestamp</title>
|
||||||
<programlisting role="php">
|
<programlisting role="php">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
<?php
|
||||||
|
|
||||||
// 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
|
||||||
|
|
||||||
@@ -190,6 +192,7 @@ function makeTimeStamp($year="", $month="", $day="")
|
|||||||
|
|
||||||
return mktime(0, 0, 0, $month, $day, $year);
|
return mktime(0, 0, 0, $month, $day, $year);
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
Reference in New Issue
Block a user