mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 11:24:27 +02:00
* some wz
* no tab * add Cdata section
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.capture">
|
<sect1 id="language.function.capture">
|
||||||
<title>capture</title>
|
<title>capture</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
@@ -72,14 +72,14 @@
|
|||||||
{include file="get_banner.tpl"}
|
{include file="get_banner.tpl"}
|
||||||
{/capture}
|
{/capture}
|
||||||
{if $smarty.capture.banner ne ""}
|
{if $smarty.capture.banner ne ""}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
{$smarty.capture.banner}
|
{$smarty.capture.banner}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/if}
|
{/if}
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.include">
|
<sect1 id="language.function.include">
|
||||||
<title>include</title>
|
<title>include</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
@@ -56,15 +56,18 @@
|
|||||||
<emphasis>include</emphasis> will be assigned to instead of
|
<emphasis>include</emphasis> will be assigned to instead of
|
||||||
displayed.
|
displayed.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>function include</title>
|
<title>function include</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{include file="header.tpl"}
|
<![CDATA[
|
||||||
|
{include file="header.tpl"}
|
||||||
|
|
||||||
{* body of template goes here *}
|
{* body of template goes here *}
|
||||||
|
|
||||||
{include file="footer.tpl"}</programlisting>
|
{include file="footer.tpl"}
|
||||||
</example>
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
</example>
|
||||||
<para>
|
<para>
|
||||||
You can also pass variables to included templates as attributes.
|
You can also pass variables to included templates as attributes.
|
||||||
Any variables explicitly passed to an included template as
|
Any variables explicitly passed to an included template as
|
||||||
@@ -72,36 +75,48 @@
|
|||||||
file. Attribute variables override current template variables, in
|
file. Attribute variables override current template variables, in
|
||||||
the case they are named alike.
|
the case they are named alike.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>function include passing variables</title>
|
<title>function include passing variables</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{include file="header.tpl" title="Main Menu" table_bgcolor="#c0c0c0"}
|
<![CDATA[
|
||||||
|
{include file="header.tpl" title="Main Menu" table_bgcolor="#c0c0c0"}
|
||||||
|
|
||||||
{* body of template goes here *}
|
{* body of template goes here *}
|
||||||
|
|
||||||
{include file="footer.tpl" logo="http://my.example.com/logo.gif"}</programlisting>
|
{include file="footer.tpl" logo="http://my.example.com/logo.gif"}
|
||||||
</example>
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
</example>
|
||||||
<para>
|
<para>
|
||||||
Use the syntax for <link
|
Use the syntax for <link
|
||||||
linkend="template.resources">template resources</link> to
|
linkend="template.resources">template resources</link> to
|
||||||
include files outside of the <link linkend="variable.template.dir">$template_dir</link> directory.
|
include files outside of the <link linkend="variable.template.dir">$template_dir</link> directory.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>function include template resource examples</title>
|
<title>function include template resource examples</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{* absolute filepath *}
|
<![CDATA[
|
||||||
{include file="/usr/local/include/templates/header.tpl"}
|
{* absolute filepath *}
|
||||||
|
{include file="/usr/local/include/templates/header.tpl"}
|
||||||
|
|
||||||
{* absolute filepath (same thing) *}
|
{* absolute filepath (same thing) *}
|
||||||
{include file="file:/usr/local/include/templates/header.tpl"}
|
{include file="file:/usr/local/include/templates/header.tpl"}
|
||||||
|
|
||||||
{* windows absolute filepath (MUST use "file:" prefix) *}
|
{* windows absolute filepath (MUST use "file:" prefix) *}
|
||||||
{include file="file:C:/www/pub/templates/header.tpl"}
|
{include file="file:C:/www/pub/templates/header.tpl"}
|
||||||
|
|
||||||
{* include from template resource named "db" *}
|
{* include from template resource named "db" *}
|
||||||
{include file="db:header.tpl"}</programlisting>
|
{include file="db:header.tpl"}
|
||||||
</example>
|
]]>
|
||||||
<para>See also <link linkend="language.function.include.php">{include_php}</link>, <link linkend="language.function.php">{php}</link> <link linkend="template.resources">Template Resources</link> and <link linkend="tips.componentized.templates">Componentized Templates</link></para>
|
</programlisting>
|
||||||
|
</example>
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="language.function.include.php">{include_php}</link>,
|
||||||
|
<link linkend="language.function.php">{php}</link>,
|
||||||
|
<link linkend="template.resources">Template Resources</link> and
|
||||||
|
<link linkend="tips.componentized.templates">Componentized Templates</link>.
|
||||||
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.insert">
|
<sect1 id="language.function.insert">
|
||||||
<title>insert</title>
|
<title>insert</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
@@ -67,12 +67,12 @@
|
|||||||
#site_id# values (gathered from a config file), and needs to
|
#site_id# values (gathered from a config file), and needs to
|
||||||
call a function to get the banner contents.
|
call a function to get the banner contents.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>function insert</title>
|
<title>function insert</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{* example of fetching a banner *}
|
{* example of fetching a banner *}
|
||||||
{insert name="getBanner" lid=#banner_location_id# sid=#site_id#}</programlisting>
|
{insert name="getBanner" lid=#banner_location_id# sid=#site_id#}</programlisting>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
In this example, we are using the name "getBanner" and passing the
|
In this example, we are using the name "getBanner" and passing the
|
||||||
parameters #banner_location_id# and #site_id#. Smarty will look
|
parameters #banner_location_id# and #site_id#. Smarty will look
|
||||||
@@ -117,8 +117,8 @@
|
|||||||
weather, search results, user feedback areas, etc.
|
weather, search results, user feedback areas, etc.
|
||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
mode: sgml
|
mode: sgml
|
||||||
sgml-omittag:t
|
sgml-omittag:t
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.literal">
|
<sect1 id="language.function.literal">
|
||||||
<title>literal</title>
|
<title>literal</title>
|
||||||
<para>
|
<para>
|
||||||
Literal tags allow a block of data to be taken literally. This is typically
|
Literal tags allow a block of data to be taken literally. This is typically
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{literal}
|
{literal}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
function isblank(field) {
|
function isblank(field) {
|
||||||
@@ -30,13 +30,16 @@
|
|||||||
}
|
}
|
||||||
// -->
|
// -->
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
{/literal}
|
{/literal}
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
<para>See also <link linkend="language.escaping">Escaping Smarty Parsing</link> </para>
|
<para>
|
||||||
</sect1>
|
See also
|
||||||
|
<link linkend="language.escaping">Escaping Smarty Parsing</link>.
|
||||||
|
</para>
|
||||||
|
</sect1>
|
||||||
|
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.php">
|
<sect1 id="language.function.php">
|
||||||
<title>php</title>
|
<title>php</title>
|
||||||
<para>
|
<para>
|
||||||
php tags allow php to be embedded directly into the template. They
|
php tags allow php to be embedded directly into the template. They
|
||||||
@@ -8,16 +8,24 @@
|
|||||||
linkend="variable.php.handling">$php_handling</link> setting. This
|
linkend="variable.php.handling">$php_handling</link> setting. This
|
||||||
is for advanced users only, not normally needed.
|
is for advanced users only, not normally needed.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>php tags</title>
|
<title>php tags</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{php}
|
<![CDATA[
|
||||||
|
{php}
|
||||||
// including a php script directly
|
// including a php script directly
|
||||||
// from the template.
|
// from the template.
|
||||||
include("/path/to/display_weather.php");
|
include("/path/to/display_weather.php");
|
||||||
{/php}</programlisting>
|
{/php}
|
||||||
</example>
|
]]>
|
||||||
<para>See also <link linkend="language.function.include.php">{include_php}</link>, <link linkend="language.function.include">{include}</link> and <link linkend="tips.componentized.templates">Componentized Templates</link></para>
|
</programlisting>
|
||||||
|
</example>
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="language.function.include.php">{include_php}</link>,
|
||||||
|
<link linkend="language.function.include">{include}</link> and
|
||||||
|
<link linkend="tips.componentized.templates">Componentized Templates</link>.
|
||||||
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.strip">
|
<sect1 id="language.function.strip">
|
||||||
<title>strip</title>
|
<title>strip</title>
|
||||||
<para>
|
<para>
|
||||||
Many times web designers run into the issue where white space and
|
Many times web designers run into the issue where white space and
|
||||||
@@ -24,9 +24,9 @@
|
|||||||
function</link>.
|
function</link>.
|
||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
<example>
|
<example>
|
||||||
<title>strip tags</title>
|
<title>strip tags</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{* the following will be all run into one line upon output *}
|
{* the following will be all run into one line upon output *}
|
||||||
{strip}
|
{strip}
|
||||||
@@ -40,14 +40,17 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
{/strip}
|
{/strip}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
OUTPUT:
|
<para>
|
||||||
|
The above example will output:
|
||||||
|
</para>
|
||||||
|
<screen>
|
||||||
|
<![CDATA[
|
||||||
<table border=0><tr><td><A HREF="http://my.example.com"><font color="red">This is a test</font></A></td></tr></table>
|
<table border=0><tr><td><A HREF="http://my.example.com"><font color="red">This is a test</font></A></td></tr></table>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</screen>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
Notice that in the above example, all the lines begin and end
|
Notice that in the above example, all the lines begin and end
|
||||||
with HTML tags. Be aware that all the lines are run together.
|
with HTML tags. Be aware that all the lines are run together.
|
||||||
|
Reference in New Issue
Block a user