From 782bd58ba0b28fde7a6249edf51b6011a3d72111 Mon Sep 17 00:00:00 2001 From: pete_morgan Date: Wed, 27 Sep 2006 00:54:40 +0000 Subject: [PATCH] Tidy up of formatting --- .../programmers/caching/caching-cacheable.xml | 45 ++++----- .../en/programmers/caching/caching-groups.xml | 66 +++++++++---- .../caching/caching-multiple-caches.xml | 75 ++++++++------- .../caching/caching-setting-up.xml | 95 ++++++++++--------- 4 files changed, 159 insertions(+), 122 deletions(-) diff --git a/docs/en/programmers/caching/caching-cacheable.xml b/docs/en/programmers/caching/caching-cacheable.xml index 2f214185..5270dec0 100644 --- a/docs/en/programmers/caching/caching-cacheable.xml +++ b/docs/en/programmers/caching/caching-cacheable.xml @@ -4,22 +4,23 @@ Controlling Cacheability of Plugins' Output Since Smarty-2.6.0 plugins the cacheability of plugins can be - declared when registering them. The third parameter to register_block(), register_compiler_function() - and register_function() is - called $cacheable and defaults to true which + declared when registering them. The third parameter to + register_block(), + + register_compiler_function() and register_function() + is called $cacheable and defaults to &true; which is also the behaviour of plugins in Smarty versions before 2.6.0 - When registering a plugin with $cacheable=false the plugin is - called everytime the page is displayed, even if the page comes + When registering a plugin with $cacheable=false the plugin + is called everytime the page is displayed, even if the page comes from the cache. The plugin function behaves a little like an - insert function. + {insert} function. - In contrast to insert + In contrast to {insert} + the attributes to the plugins are not cached by default. They can be declared to be cached with the fourth parameter $cache_attrs. $cache_attrs @@ -33,8 +34,6 @@ caching = true; function remaining_seconds($params, &$smarty) { @@ -58,7 +57,7 @@ $smarty->display('index.tpl'); ]]> - where index.tpl is: + where index.tpl is: endtime} ]]> - The number of seconds till the endtime of $obj is reached changes on - each display of the page, even if the page is cached. Since the + The number of seconds till the endtime of $obj is reached + changes on each display of the page, even if the page is cached. Since the endtime attribute is cached the object only has to be pulled from the database when page is written to the cache but not on subsequent requests of the page. @@ -81,9 +80,7 @@ Time Remaining: {remaining endtime=$obj->endtime} index.php: caching = true; +$smarty->caching = 1; function smarty_block_dynamic($param, $content, &$smarty) { return $content; @@ -95,15 +92,15 @@ $smarty->display('index.tpl'); ]]> - where index.tpl is: + where index.tpl is: When reloading the page you will notice that both dates differ. One - is "dynamic" one is "static". You can do everything between - {dynamic}...{/dynamic} and be sure it will not be cached like the rest - of the page. + is dynamic one is static. You can do everything + between {dynamic}...{/dynamic} and be sure it will not + be cached like the rest of the page. diff --git a/docs/en/programmers/caching/caching-groups.xml b/docs/en/programmers/caching/caching-groups.xml index a3ff0ddc..cb8ebfbf 100644 --- a/docs/en/programmers/caching/caching-groups.xml +++ b/docs/en/programmers/caching/caching-groups.xml @@ -3,37 +3,63 @@ Cache Groups - You can do more elaborate grouping by setting up $cache_id groups. This is - accomplished by separating each sub-group with a vertical bar "|" in the - $cache_id value. You can have as many sub-groups as you like. + You can do more elaborate grouping by setting up + $cache_id groups. This is + accomplished by separating each sub-group with a vertical bar + | in the $cache_id value. + You can have as many sub-groups as you like. - + + + You can think of cache groups like a directory hierarchy. For instance, a - cache group of "a|b|c" could be thought of as the directory structure - "/a/b/c/". clear_cache(null,"a|b|c") + cache group of 'a|b|c' could be thought of as the + directory structure '/a/b/c/'. + + + + clear_cache(null,'a|b|c') would be like removing the files - "/a/b/c/*". clear_cache(null,"a|b") would be like removing the files - "/a/b/*". If you specify a $compile_id such as - clear_cache(null,"a|b","foo") it is treated as an appended cache group - "/a/b/c/foo/". If you specify a template name such as - clear_cache("foo.tpl","a|b|c") then Smarty will attempt to remove - "/a/b/c/foo.tpl". You CANNOT remove a specified template name under - multiple cache groups such as "/a/b/*/foo.tpl", the cache grouping works + '/a/b/c/*'. clear_cache(null,'a|b') + would be like removing the files '/a/b/*'. + + + + If you specify a + $compile_id + such as clear_cache(null,'a|b','foo') it is treated as + an appended cache group '/a/b/c/foo/'. + + + + If you specify a template name such as + clear_cache('foo.tpl','a|b|c') then Smarty will attempt + to remove '/a/b/c/foo.tpl'. + + + + You CANNOT remove a specified template name under + multiple cache groups such as '/a/b/*/foo.tpl', the + cache grouping works left-to-right ONLY. You will need to group your templates under a single cache group heirarchy to be able to clear them as a group. - + + + Cache grouping should not be confused with your template directory heirarchy, the cache grouping has no knowledge of how your templates are structured. So for example, if you have a template structure like - "themes/blue/index.tpl" and you want to be able to clear all the cache - files for the "blue" theme, you will need to create a cache group + themes/blue/index.tpl and you want to be able to + clear all the cache files for the blue theme, you will need + to create a cache group structure that mimics your template file structure, such as - display("themes/blue/index.tpl","themes|blue"), then clear them with - clear_cache(null,"themes|blue"). + display('themes/blue/index.tpl','themes|blue'), then + clear them with + clear_cache(null,'themes|blue'). - cache_id groups + $cache_id groups display('index.tpl','sports|basketball'); ]]> - +