mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 02:44:27 +02:00
some WS and program roles
This commit is contained in:
@@ -36,6 +36,7 @@
|
|||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
</chapter>
|
</chapter>
|
||||||
|
|
||||||
<!-- 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
|
||||||
|
@@ -34,7 +34,8 @@ Intro = """This is a value that spans more
|
|||||||
host=my.domain.com
|
host=my.domain.com
|
||||||
db=ADDRESSBOOK
|
db=ADDRESSBOOK
|
||||||
user=php-user
|
user=php-user
|
||||||
pass=foobar</programlisting>
|
pass=foobar
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
Values of config file variables can be in quotes, but not necessary.
|
Values of config file variables can be in quotes, but not necessary.
|
||||||
@@ -67,7 +68,8 @@ pass=foobar</programlisting>
|
|||||||
editing, you can be certain that they cannot read sensitive data from
|
editing, you can be certain that they cannot read sensitive data from
|
||||||
the config file by loading it into the template.
|
the config file by loading it into the template.
|
||||||
</para>
|
</para>
|
||||||
</chapter>
|
</chapter>
|
||||||
|
|
||||||
<!-- 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
|
||||||
|
@@ -66,17 +66,20 @@
|
|||||||
<example>
|
<example>
|
||||||
<title>capturing template content</title>
|
<title>capturing template content</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
{* we don't want to print a table row unless content is displayed *}
|
{* we don't want to print a table row unless content is displayed *}
|
||||||
{capture name=banner}
|
{capture name=banner}
|
||||||
{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}</programlisting>
|
{/if}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
@@ -73,20 +73,23 @@
|
|||||||
<title>function config_load</title>
|
<title>function config_load</title>
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
{config_load file="colors.conf"}
|
{config_load file="colors.conf"}
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
<title>{#pageTitle#}</title>
|
<title>{#pageTitle#}</title>
|
||||||
<body bgcolor="{#bodyBgColor#}">
|
<body bgcolor="{#bodyBgColor#}">
|
||||||
<table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}">
|
<table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}">
|
||||||
<tr bgcolor="{#rowBgColor#}">
|
<tr bgcolor="{#rowBgColor#}">
|
||||||
<td>First</td>
|
<td>First</td>
|
||||||
<td>Last</td>
|
<td>Last</td>
|
||||||
<td>Address</td>
|
<td>Address</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</body>
|
</body>
|
||||||
</html></programlisting>
|
</html>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
Config files may also contain sections. You can load variables from
|
Config files may also contain sections. You can load variables from
|
||||||
@@ -102,22 +105,26 @@
|
|||||||
<example>
|
<example>
|
||||||
<title>function config_load with section</title>
|
<title>function config_load with section</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
{config_load file="colors.conf" section="Customer"}
|
{config_load file="colors.conf" section="Customer"}
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
<title>{#pageTitle#}</title>
|
<title>{#pageTitle#}</title>
|
||||||
<body bgcolor="{#bodyBgColor#}">
|
<body bgcolor="{#bodyBgColor#}">
|
||||||
<table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}">
|
<table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}">
|
||||||
<tr bgcolor="{#rowBgColor#}">
|
<tr bgcolor="{#rowBgColor#}">
|
||||||
<td>First</td>
|
<td>First</td>
|
||||||
<td>Last</td>
|
<td>Last</td>
|
||||||
<td>Address</td>
|
<td>Address</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</body>
|
</body>
|
||||||
</html></programlisting>
|
</html>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</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
|
||||||
|
@@ -27,23 +27,26 @@
|
|||||||
<example>
|
<example>
|
||||||
<title>strip tags</title>
|
<title>strip tags</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
|
<![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}
|
||||||
<table border=0>
|
<table border=0>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<A HREF="{$url}">
|
<A HREF="{$url}">
|
||||||
<font color="red">This is a test</font>
|
<font color="red">This is a test</font>
|
||||||
</A>
|
</A>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
{/strip}
|
{/strip}
|
||||||
|
|
||||||
|
|
||||||
OUTPUT:
|
OUTPUT:
|
||||||
|
|
||||||
<table border=0><tr><td><A HREF="http://my.domain.com"><font color="red">This is a test</font></A></td></tr></table></programlisting>
|
<table border=0><tr><td><A HREF="http://my.domain.com"><font color="red">This is a test</font></A></td></tr></table>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</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
|
||||||
@@ -52,6 +55,7 @@ OUTPUT:
|
|||||||
they will be run together, and may not be desired results.
|
they will be run together, and may not be desired results.
|
||||||
</para>
|
</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:
|
||||||
mode: sgml
|
mode: sgml
|
||||||
|
@@ -1,20 +1,22 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<chapter id="language.combining.modifiers">
|
<chapter id="language.combining.modifiers">
|
||||||
<title>Combining Modifiers</title>
|
<title>Combining Modifiers</title>
|
||||||
<para>
|
<para>
|
||||||
You can apply any number of modifiers to a variable. They will be
|
You can apply any number of modifiers to a variable. They will be
|
||||||
applied in the order they are combined, from left to right. They must
|
applied in the order they are combined, from left to right. They must
|
||||||
be separated with a <literal>|</literal> (pipe) character.
|
be separated with a <literal>|</literal> (pipe) character.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>combining modifiers</title>
|
<title>combining modifiers</title>
|
||||||
<programlisting>
|
<programlisting role="php">
|
||||||
|
<![CDATA[
|
||||||
index.php:
|
index.php:
|
||||||
|
<?php
|
||||||
$smarty = new Smarty;
|
$smarty = new Smarty;
|
||||||
$smarty->assign('articleTitle', 'Smokers are Productive, but Death Cuts Efficiency.');
|
$smarty->assign('articleTitle', 'Smokers are Productive, but Death Cuts Efficiency.');
|
||||||
$smarty->display('index.tpl');
|
$smarty->display('index.tpl');
|
||||||
|
?>
|
||||||
|
|
||||||
index.tpl:
|
index.tpl:
|
||||||
|
|
||||||
@@ -23,17 +25,23 @@ index.tpl:
|
|||||||
{$articleTitle|lower|spacify|truncate}
|
{$articleTitle|lower|spacify|truncate}
|
||||||
{$articleTitle|lower|truncate:30|spacify}
|
{$articleTitle|lower|truncate:30|spacify}
|
||||||
{$articleTitle|lower|spacify|truncate:30:". . ."}
|
{$articleTitle|lower|spacify|truncate:30:". . ."}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
OUTPUT:
|
<para>
|
||||||
|
The above example will output:
|
||||||
|
</para>
|
||||||
|
<screen>
|
||||||
|
<![CDATA[
|
||||||
Smokers are Productive, but Death Cuts Efficiency.
|
Smokers are Productive, but Death Cuts Efficiency.
|
||||||
S M O K E R S A R E P R O D U C T I V E , B U T D E A T H C U T S E F F I C I E N C Y .
|
S M O K E R S A R E P R O D U C T I V E , B U T D E A T H C U T S E F F I C I E N C Y .
|
||||||
s m o k e r s a r e p r o d u c t i v e , b u t d e a t h c u t s...
|
s m o k e r s a r e p r o d u c t i v e , b u t d e a t h c u t s...
|
||||||
s m o k e r s a r e p r o d u c t i v e , b u t . . .
|
s m o k e r s a r e p r o d u c t i v e , b u t . . .
|
||||||
s m o k e r s a r e p. . .</programlisting>
|
s m o k e r s a r e p. . .
|
||||||
</example>
|
]]>
|
||||||
</chapter>
|
</screen>
|
||||||
|
</example>
|
||||||
|
</chapter>
|
||||||
|
|
||||||
<!-- 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
|
||||||
|
@@ -19,7 +19,8 @@ $smarty->autoload_filters = array('pre' => array('trim', 'stamp'),
|
|||||||
</programlisting>
|
</programlisting>
|
||||||
</informalexample>
|
</informalexample>
|
||||||
</para>
|
</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:
|
||||||
mode: sgml
|
mode: sgml
|
||||||
|
@@ -10,21 +10,22 @@
|
|||||||
function to control cache files, which will ignore this
|
function to control cache files, which will ignore this
|
||||||
setting.
|
setting.
|
||||||
</para>
|
</para>
|
||||||
<note>
|
<note>
|
||||||
<title>Technical Note</title>
|
<title>Technical Note</title>
|
||||||
<para>
|
<para>
|
||||||
This setting must be either a relative or
|
This setting must be either a relative or
|
||||||
absolute path. include_path is not used for writing files.
|
absolute path. include_path is not used for writing files.
|
||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
<note>
|
<note>
|
||||||
<title>Technical Note</title>
|
<title>Technical Note</title>
|
||||||
<para>
|
<para>
|
||||||
It is not recommended to put this directory under
|
It is not recommended to put this directory under
|
||||||
the web server document root.
|
the web server document root.
|
||||||
</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
|
||||||
|
@@ -8,7 +8,8 @@
|
|||||||
custom <link linkend="section.template.cache.handler.func">cache
|
custom <link linkend="section.template.cache.handler.func">cache
|
||||||
handler function section</link> for details.
|
handler function section</link> for details.
|
||||||
</para>
|
</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:
|
||||||
mode: sgml
|
mode: sgml
|
||||||
|
@@ -1,34 +1,35 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="variable.cache.lifetime">
|
<sect1 id="variable.cache.lifetime">
|
||||||
<title>$cache_lifetime</title>
|
<title>$cache_lifetime</title>
|
||||||
<para>
|
<para>
|
||||||
This is the length of time in seconds that a template cache is valid.
|
This is the length of time in seconds that a template cache is valid.
|
||||||
Once this time has expired, the cache will be regenerated. $caching must
|
Once this time has expired, the cache will be regenerated. $caching must
|
||||||
be set to "true" for $cache_lifetime to have any purpose. A value of -1
|
be set to "true" for $cache_lifetime to have any purpose. A value of -1
|
||||||
will force the cache to never expire. A value of 0 will cause the cache
|
will force the cache to never expire. A value of 0 will cause the cache
|
||||||
to always regenerate (good for testing only, to disable caching a more
|
to always regenerate (good for testing only, to disable caching a more
|
||||||
efficient method is to set <link
|
efficient method is to set <link
|
||||||
linkend="variable.caching">$caching</link> = false.)
|
linkend="variable.caching">$caching</link> = false.)
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
If <link linkend="variable.force.compile">$force_compile</link> is
|
If <link linkend="variable.force.compile">$force_compile</link> is
|
||||||
enabled, the cache files will be regenerated every time, effectively
|
enabled, the cache files will be regenerated every time, effectively
|
||||||
disabling caching. You can clear all the cache files with the <link
|
disabling caching. You can clear all the cache files with the <link
|
||||||
linkend="api.clear.all.cache">clear_all_cache()</link> function, or
|
linkend="api.clear.all.cache">clear_all_cache()</link> function, or
|
||||||
individual cache files (or groups) with the <link
|
individual cache files (or groups) with the <link
|
||||||
linkend="api.clear.cache">clear_cache()</link> function.
|
linkend="api.clear.cache">clear_cache()</link> function.
|
||||||
</para>
|
</para>
|
||||||
<note>
|
<note>
|
||||||
<title>Technical Note</title>
|
<title>Technical Note</title>
|
||||||
<para>
|
<para>
|
||||||
If you want to give certain templates their own cache lifetime, you could
|
If you want to give certain templates their own cache lifetime, you could
|
||||||
do this by setting <link linkend="variable.caching">$caching</link> = 2,
|
do this by setting <link linkend="variable.caching">$caching</link> = 2,
|
||||||
then set $cache_lifetime to a unique value just before calling display()
|
then set $cache_lifetime to a unique value just before calling display()
|
||||||
or fetch().
|
or fetch().
|
||||||
</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
|
||||||
|
@@ -9,7 +9,8 @@
|
|||||||
header will be sent instead of the content. This works only on
|
header will be sent instead of the content. This works only on
|
||||||
cached content without <command>insert</command> tags.
|
cached content without <command>insert</command> tags.
|
||||||
</para>
|
</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:
|
||||||
mode: sgml
|
mode: sgml
|
||||||
|
@@ -90,9 +90,10 @@ function smarty_block_translate($params, $content, &$smarty)
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</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
|
||||||
|
@@ -64,9 +64,10 @@ function smarty_compiler_tplheader($tag_arg, &$smarty)
|
|||||||
echo 'index.tpl compiled at 2002-02-20 20:02';
|
echo 'index.tpl compiled at 2002-02-20 20:02';
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</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
|
||||||
|
@@ -99,10 +99,11 @@ function smarty_function_assign($params, &$smarty)
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</para>
|
</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:
|
||||||
mode: sgml
|
mode: sgml
|
||||||
|
@@ -22,6 +22,7 @@
|
|||||||
directories and Smarty will use it automatically.
|
directories and Smarty will use it automatically.
|
||||||
</para>
|
</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:
|
||||||
mode: sgml
|
mode: sgml
|
||||||
|
@@ -48,9 +48,10 @@ function smarty_insert_time($params, &$smarty)
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</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
|
||||||
|
@@ -89,9 +89,10 @@ function smarty_modifier_truncate($string, $length = 80, $etc = '...',
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</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
|
||||||
|
@@ -56,7 +56,8 @@
|
|||||||
needs is not found, or if the file or the plugin function are named
|
needs is not found, or if the file or the plugin function are named
|
||||||
improperly.
|
improperly.
|
||||||
</para>
|
</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:
|
||||||
mode: sgml
|
mode: sgml
|
||||||
|
@@ -42,7 +42,8 @@
|
|||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</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
|
||||||
|
@@ -56,7 +56,7 @@
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
<para></para>
|
<para></para>
|
||||||
<example>
|
<example>
|
||||||
@@ -80,9 +80,10 @@
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</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
|
||||||
|
@@ -134,9 +134,10 @@ function smarty_resource_db_trusted($tpl_name, &$smarty)
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</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
|
||||||
|
@@ -31,7 +31,8 @@ require_once $smarty->_get_plugin_filepath('function', 'html_options');
|
|||||||
<parameter>&$repeat</parameter> after the Smarty object to keep
|
<parameter>&$repeat</parameter> after the Smarty object to keep
|
||||||
backwards compatibility to older versions of Smarty).
|
backwards compatibility to older versions of Smarty).
|
||||||
</para>
|
</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:
|
||||||
mode: sgml
|
mode: sgml
|
||||||
|
Reference in New Issue
Block a user