mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 11:24:27 +02:00
tweaks
This commit is contained in:
@@ -4,17 +4,18 @@
|
|||||||
<title>$compile_id</title>
|
<title>$compile_id</title>
|
||||||
<para>
|
<para>
|
||||||
Persistant compile identifier. As an alternative to passing the same
|
Persistant compile identifier. As an alternative to passing the same
|
||||||
compile_id to each and every function call, you can set this
|
$compile_id to each and every function call, you can set this
|
||||||
compile_id and it will be used implicitly thereafter.
|
$compile_id and it will be used implicitly thereafter.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
With a compile_id you can work around the limitation that you cannot
|
With a $compile_id you can work around the limitation that you cannot
|
||||||
use the same
|
use the same
|
||||||
<link linkend="variable.compile.dir">$compile_dir</link>
|
<link linkend="variable.compile.dir">$compile_dir</link>
|
||||||
for different
|
for different
|
||||||
<link linkend="variable.template.dir">$template_dirs</link>. If you set a
|
<link linkend="variable.template.dir">$template_dirs</link>. If you set a
|
||||||
distinct compile_id for each template_dir then smarty can tell the
|
distinct $compile_id for each
|
||||||
compiled templates apart by their compile_id.
|
<link linkend="variable.template.dir">$template_dir</link> then Amarty can tell the
|
||||||
|
compiled templates apart by their $compile_id.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
If you have for example a
|
If you have for example a
|
||||||
@@ -29,13 +30,13 @@
|
|||||||
multiple domains / multiple virtual hosts.
|
multiple domains / multiple virtual hosts.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>$compile_id</title>
|
<title>$compile_id in a virtual host enviroment</title>
|
||||||
<programlisting role="php">
|
<programlisting role="php">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$smarty->compile_id = $_SERVER['SERVER_NAME'];
|
$smarty->compile_id = $_SERVER['SERVER_NAME'];
|
||||||
$smarty->compile_dir = 'path/to/shared_compile_dir';
|
$smarty->compile_dir = '/path/to/shared_compile_dir';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
|
@@ -41,18 +41,18 @@ $smarty = new Smarty;
|
|||||||
|
|
||||||
$smarty->caching = true;
|
$smarty->caching = true;
|
||||||
|
|
||||||
// clear all caches with "sports|basketball" as the first two cache_id groups
|
// clear all caches with 'sports|basketball' as the first two cache_id groups
|
||||||
$smarty->clear_cache(null,"sports|basketball");
|
$smarty->clear_cache(null,'sports|basketball');
|
||||||
|
|
||||||
// clear all caches with "sports" as the first cache_id group. This would
|
// clear all caches with "sports" as the first cache_id group. This would
|
||||||
// include "sports|basketball", or "sports|(anything)|(anything)|(anything)|..."
|
// include "sports|basketball", or "sports|(anything)|(anything)|(anything)|..."
|
||||||
$smarty->clear_cache(null,"sports");
|
$smarty->clear_cache(null,'sports');
|
||||||
|
|
||||||
// clear the foo.tpl cache file with "sports|basketball" as the cache_id
|
// clear the foo.tpl cache file with "sports|basketball" as the cache_id
|
||||||
$smarty->clear_cache("foo.tpl","sports|basketball");
|
$smarty->clear_cache('foo.tpl','sports|basketball');
|
||||||
|
|
||||||
|
|
||||||
$smarty->display('index.tpl',"sports|basketball");
|
$smarty->display('index.tpl','sports|basketball');
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
@@ -45,8 +45,8 @@ $smarty->display('index.tpl');
|
|||||||
regenerated. It is possible to give individual caches their own expiration
|
regenerated. It is possible to give individual caches their own expiration
|
||||||
time by setting
|
time by setting
|
||||||
<link linkend="variable.caching">$caching</link> = 2.
|
<link linkend="variable.caching">$caching</link> = 2.
|
||||||
See the documentation on <link
|
See <link
|
||||||
linkend="variable.cache.lifetime">$cache_lifetime</link> for details.
|
linkend="variable.cache.lifetime">$cache_lifetime</link> for more details.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>setting $cache_lifetime per cache</title>
|
<title>setting $cache_lifetime per cache</title>
|
||||||
@@ -106,7 +106,10 @@ $smarty->display('index.tpl');
|
|||||||
the cache files will always be regenerated. This effectively turns off
|
the cache files will always be regenerated. This effectively turns off
|
||||||
caching.
|
caching.
|
||||||
<link linkend="variable.force.compile">$force_compile</link>
|
<link linkend="variable.force.compile">$force_compile</link>
|
||||||
is usually for debugging purposes only, a more
|
is usually for
|
||||||
|
<link
|
||||||
|
linkend="chapter.debugging.console">debugging</link>
|
||||||
|
purposes only, a more
|
||||||
efficient way of disabling caching is to set <link
|
efficient way of disabling caching is to set <link
|
||||||
linkend="variable.caching">$caching</link> = false (or 0.)
|
linkend="variable.caching">$caching</link> = false (or 0.)
|
||||||
</para>
|
</para>
|
||||||
@@ -141,15 +144,19 @@ $smarty->display('index.tpl');
|
|||||||
You can keep parts of a page dynamic with the <link
|
You can keep parts of a page dynamic with the <link
|
||||||
linkend="language.function.insert">{insert}</link> template function. Let's
|
linkend="language.function.insert">{insert}</link> template function. Let's
|
||||||
say the whole page can be cached except for a banner that is displayed down
|
say the whole page can be cached except for a banner that is displayed down
|
||||||
the right side of the page. By using an insert function for the banner, you
|
the right side of the page. By using an
|
||||||
|
<link linkend="language.function.insert">{insert}</link>
|
||||||
|
function for the banner, you
|
||||||
can keep this element dynamic within the cached content. See the
|
can keep this element dynamic within the cached content. See the
|
||||||
documentation on <link linkend="language.function.insert">{insert}</link> for
|
documentation on <link linkend="language.function.insert">{insert}</link> for
|
||||||
details and examples.
|
more details and examples.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
You can clear all the cache files with the <link
|
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
|
||||||
|
<link linkend="caching.groups">(or groups)</link>
|
||||||
|
with the <link
|
||||||
linkend="api.clear.cache">clear_cache()</link> function.
|
linkend="api.clear.cache">clear_cache()</link> function.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
|
Reference in New Issue
Block a user