Smarty whether the template is automatically cached

Source: Internet
Author: User
Tags smarty template
Smarty is the auto-cached template?
Like what

$obj _tpl is the Smarty object
$obj _tpl->settemplateroot (dirname (__file__));
$obj _tpl->display ("Index.tpl");

Then I have 2 directories, each with index.tpl,php files and index.tpl together. That means there are 2 sets of templates.
I found the second directory read the INDEX.TPL of the first directory.
I used it.

$obj _tpl->caching=false;
$obj _tpl->clear_all_cache ();//Clear All caches
$obj _tpl->clear_cache (' index.tpl ');//Clear INDEX.TPL Cache

It doesn't work either.
The value of DirName (__file__) is different for each directory.
Can't I use a template file with the same name? The path is different. Smarty

Share to:


------Solution--------------------
You should see the PHP and HMTL compiled files, not the cache.
------Solution--------------------
Typically smarty template files are stored in the Templates directory, and the compiled template files are stored in the Template_c directory
Smarty does not cache the template because the template is user and he has no right to intervene
Smarty just reads the template file and compiles it into a php file for actual runtime use

It's not clear what you mean by "2 directories."
If this "2 directory" is two items, then this "2 directories" should have template and Template_c subdirectories respectively
If this "2 directory" is a different style for the same project, then this "2 directories" should be placed in the template subdirectory
You should bring the directory name when you use it
$obj _tpl->display ("style 2/index.tpl");
  • 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.