If the duplicate name of the smarty template is solved (different paths), the compiled file will be overwritten. -Php Tutorial

Source: Internet
Author: User
If the duplicate name of the smarty template is solved (different paths), the compiled file will be overwritten. Smarty PHP

If the duplicate name of the smarty template is solved (different paths), the compiled file will be overwritten.
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 content of the two index. tpl files is also different.
Compile the file
/Template_c/% 117/% 1172603085
As a result, file 1 and file 2 are opened in a browser and then the same index. tpl is applied.
I want to automatically apply the index. tpl of my path. How can this problem be solved?


Reply to discussion (solution)

Give your directory structure

/Mod/zhuanti0402/
Include
Index. php
Index. tpl

/Mod/zhuanti0528/
Include
Index. php
Index. tpl

/Template_c/This is a mess.
I didn't separate the directories of php and tpl template files because only one php and one tpl are required. One page is complete.

Where is smarty? How to configure and call it?

The call is like this.
$ Obj_tpl = JATUtility: UseSmarty ();
Is there configuration?

Observe how to solve this problem

I have also encountered this problem. The solution is as follows: 1. change the file name instead of using the same file name; 2. redefine compile_dir before using the smarty template each time.

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.