cvs: smarty /docs/en/designers/language-builtin-functions language-function-capture.xml
[email protected] ("Peter 'Mash' Morgan") Mon, 27 Mar 2006 23:57:57 -0000
| Newsgroups | php.smarty.cvs |
|---|---|
| Message-ID | <cvspete_morgan1143503877@cvsserver> |
pete_morgan Mon Mar 27 23:57:57 2006 UTC
Modified files:
/smarty/docs/en/designers/language-builtin-functions
language-function-capture.xml
Log:
tweek
http://cvs.php.net/viewcvs.cgi/smarty/docs/en/designers/language-builtin-functions/language-function-capture.xml?r1=1.11&r2=1.12&diff_format=u
Index: smarty/docs/en/designers/language-builtin-functions/language-function-capture.xml
diff -u smarty/docs/en/designers/language-builtin-functions/language-function-capture.xml:1.11 smarty/docs/en/designers/language-builtin-functions/language-function-capture.xml:1.12
--- smarty/docs/en/designers/language-builtin-functions/language-function-capture.xml:1.11 Sat Feb 18 13:17:30 2006
+++ smarty/docs/en/designers/language-builtin-functions/language-function-capture.xml Mon Mar 27 23:57:57 2006
@@ -1,18 +1,20 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.11 $ -->
+<!-- $Revision: 1.12 $ -->
<sect1 id="language.function.capture">
<title>{capture}</title>
<para>
- {capture} is used to collect the output of the template into a
+ {capture} is used to collect the output of the template between the tags into a
variable instead of displaying it. Any content between {capture
- name="foo"} and {/capture} is collected into the variable specified
- in the name attribute. The captured content can be used in the
- template from the special variable <link
+ name='foo'} and {/capture} is collected into the variable specified
+ in the name attribute.
+ </para>
+ <para>The captured content can be used in the
+ template from the variable <link
linkend="language.variables.smarty.capture">$smarty.capture.foo</link>
where "foo" is the value passed in the name attribute. If you do not
- supply a name attribute, then "default" will be used as the name. All {capture}
- commands must be paired with {/capture}. You can nest capture commands.
+ supply a name attribute, then "default" will be used as in $smarty.capture.default.
+ You can nest capture commands.
</para>
@@ -66,39 +68,33 @@
</caution>
<para>
<example>
- <title>capturing template content</title>
+ <title>{capture} with a the name attribute</title>
<programlisting>
<![CDATA[
-{* we don't want to print a table row unless content is displayed *}
+{* we don't want to print a div tag unless content is displayed *}
{capture name=banner}
{include file='get_banner.tpl'}
{/capture}
{if $smarty.capture.banner ne ''}
-<table>
-<tr>
- <td>
- {$smarty.capture.banner}
- </td>
-</tr>
-</table>
+<div id="banner">{$smarty.capture.banner}</div>
{/if}
]]>
</programlisting>
</example>
<example>
- <title>capturing content to a variable</title>
+ <title>{capture} into a template variable</title>
<para>This example also demonstrates the
<link linkend="language.function.popup">{popup}</link>
function</para>
<programlisting>
<![CDATA[
{capture name=some_content assign=popText}
-.... some popup content ....
+The server is {$smarty.server.SERVER_NAME|upper} at {$smarty.server.SERVER_ADDR}<br>
+Your ip is {$smarty.server.REMOTE_ADDR}.
{/capture}
-
-<a href="#" {popup caption='Help' text=$popText}>help</a>
+<a href="#" {popup caption='Server Info' text=$popText}>help</a>
]]>
</programlisting>
</example>