If the Smarty template is resolved with the same name (path different), the resulting compiled file is overwritten by the problem.

Source: Internet
Author: User
Tags smarty template
Smarty PHP

If the Smarty template is resolved with the same name (path different), the resulting compiled file is overwritten by the problem.
For example
File 1
$obj _tpl is the Smarty object $obj_tpl->settemplateroot (dirname (__file__)); $obj _tpl->display ("Index.tpl");

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

File 1 and file 2 are not in the same path. The contents of the 2 INDEX.TPL files are also different.
After running, compile the file to
/template_c/%%117/%%1172603085
Causes the file 1 and file 2 to be opened with a browser and apply the same index.tpl.
I want to implement the INDEX.TPL that automatically apply my own path respectively. How does this work?


Reply to discussion (solution)

Give your directory structure

/mod/zhuanti0402/
Contains
index.php
Index.tpl

/mod/zhuanti0528/
Contains
index.php
Index.tpl

/template_c/, it's all messed up here.
I did not separate the PHP and TPL template files from the directory because it would only take 1 PHP, one TPL. One page is all solved.

Where's the smarty? How to configure and invoke?

The call is like this
$obj _TPL = Jatutility::usesmarty ();
So, there's a configuration for this?

To observe how to solve this problem

This question I also met, at present I solve the scheme: 1, change the file name, do not use the same file name, 2, each use Smarty template before redefining Compile_dir

  • 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.