The principle of page static before Smarty cache control _php Technique

Source: Internet
Author: User
Can be set in display

$smarty->display ("Demo.tpl", $_server[request_uri]) to implement a template with multiple caches.

Now that the file has been cached, we can go to the cache file, do not loop the execution of the connection database, query. Using a function in Smatry to judge

$smarty->iscached (Demo.tpl ",", $_server[request_uri]) The default value is "True" the template here is the same as display.

There's a difference between the Smarty3 and the Smarty2.

$smarty->is_cached (Demo.tpl ",", $_server[request_uri]) smarty2

$smarty->iscached (Demo.tpl ",", $_server[request_ur]i) smarty3

But there are parts of the template that do not need to be cached, for example: User login, and the comments section of the article does not need to be cached, so we solve

1, in the PHP file, if you do not need to cache the data to be placed outside the iscached judgment.

2. In the template if you do not need to cache the part of the <{nocache}>........<{/nocache}> between.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.