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