smarty updates: cache/compile stuff
| From: | Monte Ohrt | Date: | Tue, 11 Jun 2002 20:26:31 +0000 |
| Subject: | smarty updates: cache/compile stuff | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-4789@lists.php.net to get a copy of this message | ||
Hi!
I just committed some major changes to Smarty into CVS.
1) There is a new class variable $use_sub_dirs. set this to false if you do not want to use sub directories for cache and compiled files.
2) crc32() is gone. Files written by Smarty are now the url-encoded counter parts of the real template names, so now you can make out what is what in the cache and compile directories. url encoding was used for safe file and directory names.
3) support for removal of cache and compile files by cache_id and compile_id, full or partial. The default separator is "|" (vertical pipe.) cache_id and compile_id syntax works indentical. "|" was chosen because it is an unlikely character to show up unintentionally.
examples:
// clear index.tpl cache with cache_id that is (or begins with) foo|bar
$smarty->clear_cache('index.tpl','foo|bar');
// clear ANY cached file with cache_id that is (or begins with) foo|bar
$smarty->clear_cache(null,'foo|bar');
// clear ANY cached file with cache_id that is (or begins with) foo. This would include foo|bar, foo|bar|blah, etc.
$smarty->clear_cache(null,'foo');
the compile_id superceeds cache_id, so you cannot "group" templates or caches across separate compile_ids (which makes sense.)
// clear index.tpl files for compile_id "english" and cache_id that is (or begins with) foo|bar
$smarty->clear_cache('index.tpl','foo|bar','english');
// clear ALL cache files for compile_id that is (or begins with) english|foo
$smarty->clear_cache(null,null,'english|foo');
clearing compiled files works exactly the same as clearing cache files.
// clear all compiled files with compile_id that is (or begins with) my_compile_id|foo
$smarty->clear_compiled_tpl(null,'my_compile_id|foo');
Please help test all of this! I tried each case and all seems to work, but that doesn't mean there isn't bugs :-)
Monte