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

@@ -707,31 +707,40 @@ OUTPUT: (both examples)
image tags static for optimal performance.
</para>
</note>
<example>
<title>html_image</title>
<programlisting>
index.php:
<example>
<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>
</example>
]]>
</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">
<title>html_options</title>
@@ -2680,4 +2689,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
-->

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,23 +64,36 @@ 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>
</example>
Police Begin Campaign To Rundown Jaywalkers.
]]>
</screen>
</example>
</sect1>
<sect1 id="language.modifier.count.characters">
<title>count_characters</title>
@@ -112,26 +128,40 @@ Police Begin Campaign To Rundown Jaywalkers.</programlisting>
<para>
This is used to count the number of characters in a variable.
</para>
<example>
<title>count_characters</title>
<programlisting>
index.php:
<example>
<title>count_characters</title>
<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>
</example>
33
]]>
</screen>
</example>
</sect1>
<sect1 id="language.modifier.cat">
<title>cat</title>