PHP Essay---smarty template engine single template multi-cache, local do not cache 20--21

Source: Internet
Author: User
Tags smarty template

◇ Single Template multi-cache: One template generates multiple cache files.

◇ the same template in use will generate a different page implementation, if the cache is turned on, then multiple instances generated through the same template need to be cached, which will cause problems.

◇ Solution--When invoking the display () method, provide only one in the second optional parameter, which is a unique identifier specified for each instance, and there are several cache pages for several different identifiers. For example:

$smarty display (' Index.tpl ',$_server[' Request_url ']);

◇ Local non-cache (3 methods): cache page can be cached all the page data, some of the data is not suitable for caching, such as weather information, user name information, etc., so you need to set "local not cache"

◇1, a single variable is not cached: {$title NoCache}, the variable {$title} is not cached

◇2, single variable not cached: $smarty-Assign (name, value, True)

◇3, a large number of variables are not cached: {NoCache} ... {/nocachae} where all the variables within the closing parentheses of {Nocachae} are not cached.

PHP Essay---smarty template engine single template multi-cache, local do not cache 20--21

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.