mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-02 13:21:36 +01:00
more patches from Peter: more linking and improvement of examples. thanks :)
This commit is contained in:
@@ -39,15 +39,13 @@
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', 'next x-men film, x3, delayed.');
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Where index.tpl is:
|
||||
Where template is:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
@@ -67,7 +65,8 @@ Next X-Men Film, X3, Delayed.
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
<para>See also <link linkend="language.modifier.lower">lower</link> <link linkend="language.modifier.upper">upper</link> </para>
|
||||
<para>See also <link linkend="language.modifier.lower">lower</link> <link
|
||||
linkend="language.modifier.upper">upper</link> </para>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
@@ -89,3 +88,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
||||
|
||||
|
||||
@@ -37,14 +37,14 @@
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$smarty = new Smarty;
|
||||
|
||||
$smarty->assign('articleTitle', "Psychics predict world didn't end");
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Where index.tpl is:
|
||||
Where template is:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
|
||||
@@ -39,15 +39,13 @@
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', 'Cold Wave Linked to Temperatures.');
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Where index.tpl is:
|
||||
Where template is:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
@@ -68,9 +66,10 @@ Cold Wave Linked to Temperatures.
|
||||
</screen>
|
||||
</example>
|
||||
<para>
|
||||
See also <link linkend="language.modifier.count.paragraphs">count_paragraphs</link>,
|
||||
See also
|
||||
<link linkend="language.modifier.count.words">count_words</link>,
|
||||
<link linkend="language.modifier.count.sentences">count_sentences</link> and
|
||||
<link linkend="language.modifier.count.words">count_words</link>.
|
||||
<link linkend="language.modifier.count.paragraphs">count_paragraphs</link>.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
|
||||
@@ -10,15 +10,17 @@
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', "War Dims Hope for Peace. Child's Death Ruins
|
||||
Couple's Holiday.\n\nMan is Fatally Slain. Death Causes Loneliness, Feeling of Isolation.");
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
$smarty->assign('articleTitle',
|
||||
"War Dims Hope for Peace. Child's Death Ruins Couple's Holiday.\n\n
|
||||
Man is Fatally Slain. Death Causes Loneliness, Feeling of Isolation."
|
||||
);
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Where index.tpl is:
|
||||
Where template is:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
|
||||
@@ -11,15 +11,16 @@
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', 'Two Soviet Ships Collide - One Dies. Enraged Cow Injures Farmer with Axe.');
|
||||
$smarty->display('index.tpl');
|
||||
$smarty->assign('articleTitle',
|
||||
'Two Soviet Ships Collide - One Dies.
|
||||
Enraged Cow Injures Farmer with Axe.'
|
||||
);
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Where index.tpl is:
|
||||
Where template is:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
|
||||
@@ -11,15 +11,13 @@
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', 'Dealers Will Hear Car Talk at Noon.');
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Where index.tpl is:
|
||||
Where template is:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
|
||||
@@ -53,15 +53,13 @@
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('yesterday', strtotime('-1 day'));
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Where index.tpl is:
|
||||
Where template is:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
@@ -151,7 +149,8 @@ Monday, February 5, 2001
|
||||
%n - newline character
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%p - either `am' or `pm' according to the given time value, or the corresponding strings for the current locale
|
||||
%p - either `am' or `pm' according to the given time value, or the corresponding strings for the
|
||||
current locale
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%r - time in a.m. and p.m. notation
|
||||
@@ -172,17 +171,20 @@ Monday, February 5, 2001
|
||||
%u - weekday as a decimal number [1,7], with 1 representing Monday
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%U - week number of the current year as a decimal number, starting with the first Sunday as the first day of the first week
|
||||
%U - week number of the current year as a decimal number, starting with the first Sunday as the first
|
||||
day of the first week
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%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
|
||||
%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.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%w - day of the week as a decimal, Sunday being 0
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%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 - week number of the current year as a decimal number, starting with the first Monday as the first
|
||||
day of the first week
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%x - preferred date representation for the current locale without the time
|
||||
@@ -242,3 +244,4 @@ vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
||||
|
||||
|
||||
|
||||
@@ -41,15 +41,13 @@
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', 'Dealers Will Hear Car Talk at Noon.');
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Where index.tpl is:
|
||||
Where template is:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
|
||||
@@ -44,15 +44,15 @@
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', "'Stiff Opposition Expected to Casketless Funeral Plan'");
|
||||
$smarty->display('index.tpl');
|
||||
$smarty->assign('articleTitle',
|
||||
"'Stiff Opposition Expected to Casketless Funeral Plan'"
|
||||
);
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Where index.tpl is:
|
||||
Where template is:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
|
||||
@@ -49,17 +49,18 @@
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', 'NJ judge to rule on nude beach.
|
||||
$smarty->assign('articleTitle',
|
||||
'NJ judge to rule on nude beach.
|
||||
Sun or rain expected today, dark tonight.
|
||||
Statistics show that teen pregnancy drops off significantly after 25.');
|
||||
$smarty->display('index.tpl');
|
||||
Statistics show that teen pregnancy drops off significantly after 25.'
|
||||
);
|
||||
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Where index.tpl is:
|
||||
Where template is:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
|
||||
@@ -11,15 +11,13 @@
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', 'Two Convicts Evade Noose, Jury Hung.');
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Where index.tpl is:
|
||||
Where template is:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
|
||||
@@ -13,15 +13,15 @@
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', "Sun or rain expected\ntoday, dark tonight");
|
||||
$smarty->display('index.tpl');
|
||||
$smarty->assign('articleTitle',
|
||||
"Sun or rain expected\ntoday, dark tonight"
|
||||
);
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Where index.tpl is:
|
||||
Where template is:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
|
||||
@@ -47,9 +47,7 @@
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', "Infertility unlikely to\nbe passed on, experts say.");
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
|
||||
@@ -46,15 +46,13 @@
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', "Child's Stool Great for Use in Garden.");
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Where index.tpl is:
|
||||
Where template is:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
|
||||
@@ -39,14 +39,14 @@
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$smarty = new Smarty;
|
||||
|
||||
$smarty->assign('articleTitle', 'Something Went Wrong in Jet Crash, Experts Say.');
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Where index.tpl is:
|
||||
Where template is:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
|
||||
@@ -40,15 +40,13 @@
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('number', 23.5787446);
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Where index.tpl is:
|
||||
Where template is:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
|
||||
@@ -38,16 +38,16 @@
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', "Blind Woman Gets <font face=\"helvetica\">New
|
||||
Kidney</font> from Dad she Hasn't Seen in <b>years</b>.");
|
||||
$smarty->display('index.tpl');
|
||||
$smarty->assign('articleTitle',
|
||||
"Blind Woman Gets <font face=\"helvetica\">New
|
||||
Kidney</font> from Dad she Hasn't Seen in <b>years</b>."
|
||||
);
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
where index.tpl is:
|
||||
where template is:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<title>Note</title>
|
||||
<para>
|
||||
If you want to strip blocks of template text, use the <link
|
||||
linkend="language.function.strip">strip function</link>.
|
||||
linkend="language.function.strip">{strip}</link> function.
|
||||
</para>
|
||||
</note>
|
||||
<example>
|
||||
@@ -27,7 +27,7 @@ $smarty->display('index.tpl');
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
where index.tpl is:
|
||||
where template is:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
|
||||
@@ -60,15 +60,13 @@
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', 'Two Sisters Reunite after Eighteen Years at Checkout Counter.');
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
where index.tpl is:
|
||||
where template is:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
|
||||
@@ -11,15 +11,13 @@
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', "If Strike isn't Settled Quickly it may Last a While.");
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
where index.tpl is:
|
||||
where template is:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
|
||||
@@ -46,10 +46,10 @@
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
This wraps a string to a column width, default is 80. As
|
||||
<command>wordwrap</command> wraps a string to a column width, default is 80. As
|
||||
an optional second parameter, you can specify a string of text
|
||||
to wrap the text to the next line (default is carriage return \n).
|
||||
By default, wordwrap will attempt to wrap at a word boundary. If
|
||||
By default, {wordwrap} will attempt to wrap at a word boundary. If
|
||||
you want to cut off at the exact character length, pass the optional
|
||||
third parameter of true. This is equivalent to the PHP <ulink
|
||||
url="&url.php-manual;wordwrap">wordwrap()</ulink> function.
|
||||
@@ -60,15 +60,15 @@
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', "Blind woman gets new kidney from dad she hasn't seen in years.");
|
||||
$smarty->display('index.tpl');
|
||||
$smarty->assign('articleTitle',
|
||||
"Blind woman gets new kidney from dad she hasn't seen in years."
|
||||
);
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
where index.tpl is:
|
||||
where template is
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
@@ -110,7 +110,9 @@ years.
|
||||
</screen>
|
||||
</example>
|
||||
<para>
|
||||
See also <link linkend="language.modifier.nl2br">nl2br</link>.
|
||||
See also <link linkend="language.modifier.nl2br">nl2br</link>
|
||||
and
|
||||
<link linkend="language.function.textformat">{textformat}</link>.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
@@ -134,3 +136,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
||||
|
||||
|
||||
Reference in New Issue
Block a user