more CDATA's

This commit is contained in:
didou
2004-03-31 08:44:56 +00:00
parent 7b6b7cb0c3
commit 30fc005a67
2 changed files with 83 additions and 44 deletions

View File

@@ -708,29 +708,38 @@ OUTPUT: (both examples)
</para>
</note>
<example>
<title>html_image</title>
<programlisting>
index.php:
<title>html_image example</title>
<programlisting role="php">
<![CDATA[
<?php
require('Smarty.class.php');
$smarty = new Smarty;
$smarty-&gt;display('index.tpl');
index.tpl:
$smarty->display('index.tpl');
?>
]]>
</programlisting>
<para>
where index.tpl is:
</para>
<programlisting>
<![CDATA[
{html_image file="pumpkin.jpg"}
{html_image file="/path/from/docroot/pumpkin.jpg"}
{html_image file="../path/relative/to/currdir/pumpkin.jpg"}
OUTPUT: (possible)
&lt;img src="pumpkin.jpg" alt="" border="0" width="44" height="68" /&gt;
&lt;img src="/path/from/docroot/pumpkin.jpg" alt="" border="0" width="44" height="68" /&gt;
&lt;img src="../path/relative/to/currdir/pumpkin.jpg" alt="" border="0" width="44" height="68" /&gt;</programlisting>
]]>
</programlisting>
<para>
a possible output would be:
</para>
<screen>
<![CDATA[
<img src="pumpkin.jpg" alt="" border="0" width="44" height="68" />
<img src="/path/from/docroot/pumpkin.jpg" alt="" border="0" width="44" height="68" />
<img src="../path/relative/to/currdir/pumpkin.jpg" alt="" border="0" width="44" height="68" />
]]>
</screen>
</example>
</sect1>
<sect1 id="language.function.html.options">

View File

@@ -12,8 +12,9 @@
<example>
<title>modifier example</title>
<programlisting>
<![CDATA[
{* Uppercase the title *}
&lt;h2&gt;{$title|upper}&lt;/h2&gt;
<h2>{$title|upper}</h2>
{* Truncate the topic to 40 characters use ... at the end *}
Topic: {$topic|truncate:40:"..."}
@@ -22,7 +23,9 @@ Topic: {$topic|truncate:40:"..."}
{"now"|date_format:"%Y/%m/%d"}
{* apply modifier to a custom function *}
{mailto|upper address="me@domain.dom"}</programlisting>
{mailto|upper address="me@domain.dom"}
]]>
</programlisting>
</example>
<para>
If you apply a modifier to an array variable instead of a single value variable,
@@ -61,22 +64,35 @@ Topic: {$topic|truncate:40:"..."}
</para>
<example>
<title>capitalize</title>
<programlisting>
index.php:
<programlisting role="php">
<![CDATA[
<?php
$smarty = new Smarty;
$smarty-&gt;assign('articleTitle', 'Police begin campaign to rundown jaywalkers.');
$smarty-&gt;display('index.tpl');
index.tpl:
$smarty->assign('articleTitle', 'Police begin campaign to rundown jaywalkers.');
$smarty->display('index.tpl');
?>
]]>
</programlisting>
<para>
Where index.tpl is:
</para>
<programlisting>
<![CDATA[
{$articleTitle}
{$articleTitle|capitalize}
OUTPUT:
]]>
</programlisting>
<para>
This will output:
</para>
<screen>
<![CDATA[
Police begin campaign to rundown jaywalkers.
Police Begin Campaign To Rundown Jaywalkers.</programlisting>
Police Begin Campaign To Rundown Jaywalkers.
]]>
</screen>
</example>
</sect1>
<sect1 id="language.modifier.count.characters">
@@ -114,23 +130,37 @@ Police Begin Campaign To Rundown Jaywalkers.</programlisting>
</para>
<example>
<title>count_characters</title>
<programlisting>
index.php:
<programlisting role="php">
<![CDATA[
<?php
$smarty = new Smarty;
$smarty-&gt;assign('articleTitle', 'Cold Wave Linked to Temperatures.');
$smarty-&gt;display('index.tpl');
index.tpl:
$smarty->assign('articleTitle', 'Cold Wave Linked to Temperatures.');
$smarty->display('index.tpl');
?>
]]>
</programlisting>
<para>
Where index.tpl is:
</para>
<programlisting>
<![CDATA[
{$articleTitle}
{$articleTitle|count_characters}
{$articleTitle|count_characters:true}
OUTPUT:
]]>
</programlisting>
<para>
This will output:
</para>
<screen>
<![CDATA[
Cold Wave Linked to Temperatures.
29
33</programlisting>
33
]]>
</screen>
</example>
</sect1>
<sect1 id="language.modifier.cat">