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. image tags static for optimal performance.
</para> </para>
</note> </note>
<example> <example>
<title>html_image</title> <title>html_image example</title>
<programlisting> <programlisting role="php">
index.php: <![CDATA[
<?php
require('Smarty.class.php'); require('Smarty.class.php');
$smarty = new Smarty; $smarty = new Smarty;
$smarty-&gt;display('index.tpl'); $smarty->display('index.tpl');
index.tpl:
?>
]]>
</programlisting>
<para>
where index.tpl is:
</para>
<programlisting>
<![CDATA[
{html_image file="pumpkin.jpg"} {html_image file="pumpkin.jpg"}
{html_image file="/path/from/docroot/pumpkin.jpg"} {html_image file="/path/from/docroot/pumpkin.jpg"}
{html_image file="../path/relative/to/currdir/pumpkin.jpg"} {html_image file="../path/relative/to/currdir/pumpkin.jpg"}
]]>
OUTPUT: (possible) </programlisting>
<para>
&lt;img src="pumpkin.jpg" alt="" border="0" width="44" height="68" /&gt; a possible output would be:
&lt;img src="/path/from/docroot/pumpkin.jpg" alt="" border="0" width="44" height="68" /&gt; </para>
&lt;img src="../path/relative/to/currdir/pumpkin.jpg" alt="" border="0" width="44" height="68" /&gt;</programlisting> <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" />
</example> ]]>
</screen>
</example>
</sect1> </sect1>
<sect1 id="language.function.html.options"> <sect1 id="language.function.html.options">
<title>html_options</title> <title>html_options</title>
@@ -2680,4 +2689,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml vim: et tw=78 syn=sgml
vi: ts=1 sw=1 vi: ts=1 sw=1
--> -->

View File

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