Template path problem of TP framework and definition of common template constants

Source: Internet
Author: User

In the TP framework, in order to load static files for each module convenient, often do not need to follow the default way to place static files to the/app/module name/views/below, but in the top-level directory to create a new directory (such as the./tpl directory), to store static files
Setup method:
(1): defined in the import file of TP:
Define (' Tmpl_path ', './tpl/'); Defining Template Paths
(2): Manually create the./TPL directory (Note that the framework does not automatically generate the directory and needs to be set manually)
(3): Set a new directory in the TPL directory as needed
Example:/module name/Controller name/file
/public/Public File
(4): In order to facilitate the front-end introduction of files, you need to define common template constants
Note: The framework has defined common template constants, and new custom constants need to be set in the Convention of the framework
For example: tmpl_parse_string ' = = Array (
' __tmpl__ ' = __root__. ' /tpl ',
' __upload__ ' = __root__. /data/upload ",
),

Template path problem of TP framework and definition of common template constants

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.