In details about the Smarty cache operation in PHP (1), we learned how to operate the global cache of smarty. Now let's take a look at how some of the smarty caches are implemented. in details about the Smarty cache operations in PHP (1), we understand how the smarty global cache operates. Now let's take a look at how some of the smarty caches are implemented.
######################################## #####################
2. partial cache
First, you need to know what part of the cache is, in fact, specifying some files to generate cache files, rather than all the files on the website. After learning about the expected results, let's take a look at the specific operations.
Before the operation, we must emphasize the following concept:
The essence of partial cache is that some files are not cached. that is to say, instead of specifying those files to generate the cache, some specific files are not cached.
++ ++
Assume there are three files:
1. php // cache required
2. php // cache required
3. php // no cache required
In the 1.php/2. php file, write $ smarty-> display ('corresponding template filename ', 'Add part of cache filename.
But in 3. in php, we need to specify that no cache needs to be generated. the specific method is $ smarty-> clear_cache ('corresponding template filename ') // It can be written before or after $ smarty-> display ('corresponding template filename ')
Of course, $ smarty-> display ('Template file name' corresponding to it) still needs to be written, so we didn't want to generate the cache, and the second parameter is not needed.
The parameters of $ smarty-> clear_cache () and $ smarty-> display () must be consistent.
++ ++
Original article reproduced in: http://www.zhangenmin.com/index.php/smartycache2/
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.