mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 10:54:27 +02:00
cleaned the WS in this file and added more CDATA
# if I ever see a bad WS in this file, I'll kill someone :)
This commit is contained in:
@@ -338,7 +338,7 @@ Dealers Will Hear Car Talk at Noon.
|
|||||||
]]>
|
]]>
|
||||||
</screen>
|
</screen>
|
||||||
</example>
|
</example>
|
||||||
</sect1> <!-- didou -->
|
</sect1>
|
||||||
<sect1 id="language.modifier.date.format">
|
<sect1 id="language.modifier.date.format">
|
||||||
<title>date_format</title>
|
<title>date_format</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
@@ -386,31 +386,43 @@ Dealers Will Hear Car Talk at Noon.
|
|||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>date_format</title>
|
<title>date_format</title>
|
||||||
<programlisting>
|
<programlisting role="php">
|
||||||
index.php:
|
<![CDATA[
|
||||||
|
<?php
|
||||||
|
|
||||||
$smarty = new Smarty;
|
$smarty = new Smarty;
|
||||||
$smarty->assign('yesterday', strtotime('-1 day'));
|
$smarty->assign('yesterday', strtotime('-1 day'));
|
||||||
$smarty->display('index.tpl');
|
$smarty->display('index.tpl');
|
||||||
|
|
||||||
index.tpl:
|
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
<para>
|
||||||
|
Where index.tpl is:
|
||||||
|
</para>
|
||||||
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
{$smarty.now|date_format}
|
{$smarty.now|date_format}
|
||||||
{$smarty.now|date_format:"%A, %B %e, %Y"}
|
{$smarty.now|date_format:"%A, %B %e, %Y"}
|
||||||
{$smarty.now|date_format:"%H:%M:%S"}
|
{$smarty.now|date_format:"%H:%M:%S"}
|
||||||
{$yesterday|date_format}
|
{$yesterday|date_format}
|
||||||
{$yesterday|date_format:"%A, %B %e, %Y"}
|
{$yesterday|date_format:"%A, %B %e, %Y"}
|
||||||
{$yesterday|date_format:"%H:%M:%S"}
|
{$yesterday|date_format:"%H:%M:%S"}
|
||||||
|
]]>
|
||||||
OUTPUT:
|
</programlisting>
|
||||||
|
<para>
|
||||||
|
This will output:
|
||||||
|
</para>
|
||||||
|
<screen>
|
||||||
|
<![CDATA[
|
||||||
Feb 6, 2001
|
Feb 6, 2001
|
||||||
Tuesday, February 6, 2001
|
Tuesday, February 6, 2001
|
||||||
14:33:00
|
14:33:00
|
||||||
Feb 5, 2001
|
Feb 5, 2001
|
||||||
Monday, February 5, 2001
|
Monday, February 5, 2001
|
||||||
14:33:00</programlisting>
|
14:33:00
|
||||||
|
]]>
|
||||||
|
</screen>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
date_format conversion specifiers:
|
date_format conversion specifiers:
|
||||||
@@ -537,8 +549,8 @@ Dealers Will Hear Car Talk at Noon.
|
|||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
<sect1 id="language.modifier.default">
|
<sect1 id="language.modifier.default">
|
||||||
<title>default</title>
|
<title>default</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
@@ -576,22 +588,35 @@ Dealers Will Hear Car Talk at Noon.
|
|||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>default</title>
|
<title>default</title>
|
||||||
<programlisting>
|
<programlisting role="php">
|
||||||
index.php:
|
<![CDATA[
|
||||||
|
<?php
|
||||||
|
|
||||||
$smarty = new Smarty;
|
$smarty = new Smarty;
|
||||||
$smarty->assign('articleTitle', 'Dealers Will Hear Car Talk at Noon.');
|
$smarty->assign('articleTitle', 'Dealers Will Hear Car Talk at Noon.');
|
||||||
$smarty->display('index.tpl');
|
$smarty->display('index.tpl');
|
||||||
|
|
||||||
index.tpl:
|
|
||||||
|
|
||||||
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
<para>
|
||||||
|
Where index.tpl is:
|
||||||
|
</para>
|
||||||
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
{$articleTitle|default:"no title"}
|
{$articleTitle|default:"no title"}
|
||||||
{$myTitle|default:"no title"}
|
{$myTitle|default:"no title"}
|
||||||
|
]]>
|
||||||
OUTPUT:
|
</programlisting>
|
||||||
|
<para>
|
||||||
|
This will output:
|
||||||
|
</para>
|
||||||
|
<screen>
|
||||||
|
<![CDATA[
|
||||||
Dealers Will Hear Car Talk at Noon.
|
Dealers Will Hear Car Talk at Noon.
|
||||||
no title</programlisting>
|
no title
|
||||||
|
]]>
|
||||||
|
</screen>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
<sect1 id="language.modifier.escape">
|
<sect1 id="language.modifier.escape">
|
||||||
@@ -634,32 +659,47 @@ Dealers Will Hear Car Talk at Noon.
|
|||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>escape</title>
|
<title>escape</title>
|
||||||
<programlisting>
|
<programlisting role="php">
|
||||||
index.php:
|
<![CDATA[
|
||||||
|
<?php
|
||||||
|
|
||||||
$smarty = new Smarty;
|
$smarty = new Smarty;
|
||||||
$smarty->assign('articleTitle', "'Stiff Opposition Expected to Casketless Funeral Plan'");
|
$smarty->assign('articleTitle', "'Stiff Opposition Expected to Casketless Funeral Plan'");
|
||||||
$smarty->display('index.tpl');
|
$smarty->display('index.tpl');
|
||||||
|
|
||||||
index.tpl:
|
|
||||||
|
|
||||||
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
<para>
|
||||||
|
Where index.tpl is:
|
||||||
|
</para>
|
||||||
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
{$articleTitle}
|
{$articleTitle}
|
||||||
{$articleTitle|escape}
|
{$articleTitle|escape}
|
||||||
{$articleTitle|escape:"html"} {* escapes & " ' < > *}
|
{$articleTitle|escape:"html"} {* escapes & " ' < > *}
|
||||||
{$articleTitle|escape:"htmlall"} {* escapes ALL html entities *}
|
{$articleTitle|escape:"htmlall"} {* escapes ALL html entities *}
|
||||||
{$articleTitle|escape:"url"}
|
{$articleTitle|escape:"url"}
|
||||||
{$articleTitle|escape:"quotes"}
|
{$articleTitle|escape:"quotes"}
|
||||||
<a href="mailto:{$EmailAddress|escape:"hex"}">{$EmailAddress|escape:"hexentity"}</a>
|
<a
|
||||||
|
href="mailto:{$EmailAddress|escape:"hex"}">{$EmailAddress|escape:"hexentity"}</a>
|
||||||
OUTPUT:
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
<para>
|
||||||
|
This will output:
|
||||||
|
</para>
|
||||||
|
<screen>
|
||||||
|
<![CDATA[
|
||||||
'Stiff Opposition Expected to Casketless Funeral Plan'
|
'Stiff Opposition Expected to Casketless Funeral Plan'
|
||||||
'Stiff Opposition Expected to Casketless Funeral Plan'
|
'Stiff Opposition Expected to Casketless Funeral Plan'
|
||||||
'Stiff Opposition Expected to Casketless Funeral Plan'
|
'Stiff Opposition Expected to Casketless Funeral Plan'
|
||||||
'Stiff Opposition Expected to Casketless Funeral Plan'
|
'Stiff Opposition Expected to Casketless Funeral Plan'
|
||||||
%27Stiff+Opposition+Expected+to+Casketless+Funeral+Plan%27
|
%27Stiff+Opposition+Expected+to+Casketless+Funeral+Plan%27
|
||||||
\'Stiff Opposition Expected to Casketless Funeral Plan\'
|
\'Stiff Opposition Expected to Casketless Funeral Plan\'
|
||||||
<a href="mailto:%62%6f%62%40%6d%65%2e%6e%65%74">bob@me.net</a></programlisting>
|
<a
|
||||||
|
href="mailto:%62%6f%62%40%6d%65%2e%6e%65%74">bob@me.net</a>
|
||||||
|
]]>
|
||||||
|
</screen>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
<sect1 id="language.modifier.indent">
|
<sect1 id="language.modifier.indent">
|
||||||
@@ -707,15 +747,22 @@ Dealers Will Hear Car Talk at Noon.
|
|||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>indent</title>
|
<title>indent</title>
|
||||||
<programlisting>
|
<programlisting role="php">
|
||||||
index.php:
|
<![CDATA[
|
||||||
|
<?php
|
||||||
|
|
||||||
$smarty = new Smarty;
|
$smarty = new Smarty;
|
||||||
$smarty->assign('articleTitle', 'NJ judge to rule on nude beach.');
|
$smarty->assign('articleTitle', 'NJ judge to rule on nude beach.');
|
||||||
$smarty->display('index.tpl');
|
$smarty->display('index.tpl');
|
||||||
|
|
||||||
index.tpl:
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
<para>
|
||||||
|
Where index.tpl is:
|
||||||
|
</para>
|
||||||
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
{$articleTitle}
|
{$articleTitle}
|
||||||
|
|
||||||
{$articleTitle|indent}
|
{$articleTitle|indent}
|
||||||
@@ -723,9 +770,13 @@ Dealers Will Hear Car Talk at Noon.
|
|||||||
{$articleTitle|indent:10}
|
{$articleTitle|indent:10}
|
||||||
|
|
||||||
{$articleTitle|indent:1:"\t"}
|
{$articleTitle|indent:1:"\t"}
|
||||||
|
]]>
|
||||||
OUTPUT:
|
</programlisting>
|
||||||
|
<para>
|
||||||
|
this will output:
|
||||||
|
</para>
|
||||||
|
<screen>
|
||||||
|
<![CDATA[
|
||||||
NJ judge to rule on nude beach.
|
NJ judge to rule on nude beach.
|
||||||
Sun or rain expected today, dark tonight.
|
Sun or rain expected today, dark tonight.
|
||||||
Statistics show that teen pregnancy drops off significantly after 25.
|
Statistics show that teen pregnancy drops off significantly after 25.
|
||||||
@@ -740,7 +791,9 @@ Dealers Will Hear Car Talk at Noon.
|
|||||||
|
|
||||||
NJ judge to rule on nude beach.
|
NJ judge to rule on nude beach.
|
||||||
Sun or rain expected today, dark tonight.
|
Sun or rain expected today, dark tonight.
|
||||||
Statistics show that teen pregnancy drops off significantly after 25.</programlisting>
|
Statistics show that teen pregnancy drops off significantly after 25.
|
||||||
|
]]>
|
||||||
|
</screen>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
<sect1 id="language.modifier.lower">
|
<sect1 id="language.modifier.lower">
|
||||||
@@ -750,22 +803,35 @@ Dealers Will Hear Car Talk at Noon.
|
|||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>lower</title>
|
<title>lower</title>
|
||||||
<programlisting>
|
<programlisting role="php">
|
||||||
index.php:
|
<![CDATA[
|
||||||
|
<?php
|
||||||
|
|
||||||
$smarty = new Smarty;
|
$smarty = new Smarty;
|
||||||
$smarty->assign('articleTitle', 'Two Convicts Evade Noose, Jury Hung.');
|
$smarty->assign('articleTitle', 'Two Convicts Evade Noose, Jury Hung.');
|
||||||
$smarty->display('index.tpl');
|
$smarty->display('index.tpl');
|
||||||
|
|
||||||
index.tpl:
|
|
||||||
|
|
||||||
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
<para>
|
||||||
|
Where index.tpl is:
|
||||||
|
</para>
|
||||||
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
{$articleTitle}
|
{$articleTitle}
|
||||||
{$articleTitle|lower}
|
{$articleTitle|lower}
|
||||||
|
]]>
|
||||||
OUTPUT:
|
</programlisting>
|
||||||
|
<para>
|
||||||
|
This will output:
|
||||||
|
</para>
|
||||||
|
<screen>
|
||||||
|
<![CDATA[
|
||||||
Two Convicts Evade Noose, Jury Hung.
|
Two Convicts Evade Noose, Jury Hung.
|
||||||
two convicts evade noose, jury hung.</programlisting>
|
two convicts evade noose, jury hung.
|
||||||
|
]]>
|
||||||
|
</screen>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
<sect1 id="language.modifier.nl2br">
|
<sect1 id="language.modifier.nl2br">
|
||||||
@@ -776,20 +842,33 @@ Dealers Will Hear Car Talk at Noon.
|
|||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>nl2br</title>
|
<title>nl2br</title>
|
||||||
<programlisting>
|
<programlisting role="php">
|
||||||
index.php:
|
<![CDATA[
|
||||||
|
<?php
|
||||||
|
|
||||||
$smarty = new Smarty;
|
$smarty = new Smarty;
|
||||||
$smarty->assign('articleTitle', "Sun or rain expected\ntoday, dark tonight");
|
$smarty->assign('articleTitle', "Sun or rain expected\ntoday, dark tonight");
|
||||||
$smarty->display('index.tpl');
|
$smarty->display('index.tpl');
|
||||||
|
|
||||||
index.tpl:
|
|
||||||
|
|
||||||
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
<para>
|
||||||
|
Where index.tpl is:
|
||||||
|
</para>
|
||||||
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
{$articleTitle|nl2br}
|
{$articleTitle|nl2br}
|
||||||
|
]]>
|
||||||
OUTPUT:
|
</programlisting>
|
||||||
|
<para>
|
||||||
Sun or rain expected<br />today, dark tonight</programlisting>
|
This should output:
|
||||||
|
</para>
|
||||||
|
<screen>
|
||||||
|
<![CDATA[
|
||||||
|
Sun or rain expected<br />today, dark tonight
|
||||||
|
]]>
|
||||||
|
</screen>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
<sect1 id="language.modifier.regex.replace">
|
<sect1 id="language.modifier.regex.replace">
|
||||||
@@ -852,7 +931,8 @@ Dealers Will Hear Car Talk at Noon.
|
|||||||
|
|
||||||
Infertility unlikely to
|
Infertility unlikely to
|
||||||
be passed on, experts say.
|
be passed on, experts say.
|
||||||
Infertility unlikely to be passed on, experts say.</programlisting>
|
Infertility unlikely to be passed on, experts say.
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
<sect1 id="language.modifier.replace">
|
<sect1 id="language.modifier.replace">
|
||||||
@@ -913,7 +993,8 @@ Dealers Will Hear Car Talk at Noon.
|
|||||||
|
|
||||||
Child's Stool Great for Use in Garden.
|
Child's Stool Great for Use in Garden.
|
||||||
Child's Stool Great for Use in Vineyard.
|
Child's Stool Great for Use in Vineyard.
|
||||||
Child's Stool Great for Use in Garden.</programlisting>
|
Child's Stool Great for Use in Garden.
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
<sect1 id="language.modifier.spacify">
|
<sect1 id="language.modifier.spacify">
|
||||||
@@ -969,7 +1050,8 @@ Dealers Will Hear Car Talk at Noon.
|
|||||||
|
|
||||||
Something Went Wrong in Jet Crash, Experts Say.
|
Something Went Wrong in Jet Crash, Experts Say.
|
||||||
S o m e t h i n g W e n t W r o n g i n J e t C r a s h , E x p e r t s S a y .
|
S o m e t h i n g W e n t W r o n g i n J e t C r a s h , E x p e r t s S a y .
|
||||||
S^^o^^m^^e^^t^^h^^i^^n^^g^^ ^^W^^e^^n^^t^^ ^^W^^r^^o^^n^^g^^ ^^i^^n^^ ^^J^^e^^t^^ ^^C^^r^^a^^s^^h^^,^^ ^^E^^x^^p^^e^^r^^t^^s^^ ^^S^^a^^y^^.</programlisting>
|
S^^o^^m^^e^^t^^h^^i^^n^^g^^ ^^W^^e^^n^^t^^ ^^W^^r^^o^^n^^g^^ ^^i^^n^^ ^^J^^e^^t^^ ^^C^^r^^a^^s^^h^^,^^ ^^E^^x^^p^^e^^r^^t^^s^^ ^^S^^a^^y^^.
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
<sect1 id="language.modifier.string.format">
|
<sect1 id="language.modifier.string.format">
|
||||||
@@ -1024,7 +1106,8 @@ Dealers Will Hear Car Talk at Noon.
|
|||||||
|
|
||||||
23.5787446
|
23.5787446
|
||||||
23.58
|
23.58
|
||||||
24</programlisting>
|
24
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
<sect1 id="language.modifier.strip">
|
<sect1 id="language.modifier.strip">
|
||||||
@@ -1062,7 +1145,8 @@ Grandmother of
|
|||||||
eight makes hole in one.
|
eight makes hole in one.
|
||||||
Grandmother of eight makes hole in one.
|
Grandmother of eight makes hole in one.
|
||||||
Grandmother of eight makes hole in one.
|
Grandmother of eight makes hole in one.
|
||||||
]]></programlisting>
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
<sect1 id="language.modifier.strip.tags">
|
<sect1 id="language.modifier.strip.tags">
|
||||||
@@ -1087,7 +1171,8 @@ Grandmother of eight makes hole in one.
|
|||||||
OUTPUT:
|
OUTPUT:
|
||||||
|
|
||||||
Blind Woman Gets <font face="helvetica">New Kidney</font> from Dad she Hasn't Seen in <b>years</b>.
|
Blind Woman Gets <font face="helvetica">New Kidney</font> from Dad she Hasn't Seen in <b>years</b>.
|
||||||
Blind Woman Gets New Kidney from Dad she Hasn't Seen in years.</programlisting>
|
Blind Woman Gets New Kidney from Dad she Hasn't Seen in years.
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
<sect1 id="language.modifier.truncate">
|
<sect1 id="language.modifier.truncate">
|
||||||
@@ -1171,7 +1256,8 @@ Grandmother of eight makes hole in one.
|
|||||||
Two Sisters Reunite after
|
Two Sisters Reunite after
|
||||||
Two Sisters Reunite after---
|
Two Sisters Reunite after---
|
||||||
Two Sisters Reunite after Eigh
|
Two Sisters Reunite after Eigh
|
||||||
Two Sisters Reunite after E...</programlisting>
|
Two Sisters Reunite after E...
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
<sect1 id="language.modifier.upper">
|
<sect1 id="language.modifier.upper">
|
||||||
@@ -1196,7 +1282,8 @@ Grandmother of eight makes hole in one.
|
|||||||
OUTPUT:
|
OUTPUT:
|
||||||
|
|
||||||
If Strike isn't Settled Quickly it may Last a While.
|
If Strike isn't Settled Quickly it may Last a While.
|
||||||
IF STRIKE ISN'T SETTLED QUICKLY IT MAY LAST A WHILE.</programlisting>
|
IF STRIKE ISN'T SETTLED QUICKLY IT MAY LAST A WHILE.
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
<sect1 id="language.modifier.wordwrap">
|
<sect1 id="language.modifier.wordwrap">
|
||||||
@@ -1291,11 +1378,13 @@ Grandmother of eight makes hole in one.
|
|||||||
|
|
||||||
Blind woman gets new kidney fr
|
Blind woman gets new kidney fr
|
||||||
om dad she hasn't seen in year
|
om dad she hasn't seen in year
|
||||||
s.</programlisting>
|
s.
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
</chapter>
|
</chapter>
|
||||||
|
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
mode: sgml
|
mode: sgml
|
||||||
|
Reference in New Issue
Block a user