mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 03:14:27 +02:00
tweaks
This commit is contained in:
@@ -4,17 +4,18 @@
|
||||
<title>$compile_id</title>
|
||||
<para>
|
||||
Persistant compile identifier. As an alternative to passing the same
|
||||
compile_id to each and every function call, you can set this
|
||||
compile_id and it will be used implicitly thereafter.
|
||||
$compile_id to each and every function call, you can set this
|
||||
$compile_id and it will be used implicitly thereafter.
|
||||
</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
|
||||
<link linkend="variable.compile.dir">$compile_dir</link>
|
||||
for different
|
||||
<link linkend="variable.template.dir">$template_dirs</link>. If you set a
|
||||
distinct compile_id for each template_dir then smarty can tell the
|
||||
compiled templates apart by their compile_id.
|
||||
distinct $compile_id for each
|
||||
<link linkend="variable.template.dir">$template_dir</link> then Amarty can tell the
|
||||
compiled templates apart by their $compile_id.
|
||||
</para>
|
||||
<para>
|
||||
If you have for example a
|
||||
@@ -29,13 +30,13 @@
|
||||
multiple domains / multiple virtual hosts.
|
||||
</para>
|
||||
<example>
|
||||
<title>$compile_id</title>
|
||||
<title>$compile_id in a virtual host enviroment</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$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;
|
||||
|
||||
// clear all caches with "sports|basketball" as the first two cache_id groups
|
||||
$smarty->clear_cache(null,"sports|basketball");
|
||||
// clear all caches with 'sports|basketball' as the first two cache_id groups
|
||||
$smarty->clear_cache(null,'sports|basketball');
|
||||
|
||||
// clear all caches with "sports" as the first cache_id group. This would
|
||||
// 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
|
||||
$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>
|
||||
|
@@ -45,8 +45,8 @@ $smarty->display('index.tpl');
|
||||
regenerated. It is possible to give individual caches their own expiration
|
||||
time by setting
|
||||
<link linkend="variable.caching">$caching</link> = 2.
|
||||
See the documentation on <link
|
||||
linkend="variable.cache.lifetime">$cache_lifetime</link> for details.
|
||||
See <link
|
||||
linkend="variable.cache.lifetime">$cache_lifetime</link> for more details.
|
||||
</para>
|
||||
<example>
|
||||
<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
|
||||
caching.
|
||||
<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
|
||||
linkend="variable.caching">$caching</link> = false (or 0.)
|
||||
</para>
|
||||
@@ -141,15 +144,19 @@ $smarty->display('index.tpl');
|
||||
You can keep parts of a page dynamic with the <link
|
||||
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
|
||||
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
|
||||
documentation on <link linkend="language.function.insert">{insert}</link> for
|
||||
details and examples.
|
||||
more details and examples.
|
||||
</para>
|
||||
<para>
|
||||
You can clear all the cache files with the <link
|
||||
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.
|
||||
</para>
|
||||
<example>
|
||||
|
Reference in New Issue
Block a user