How to remove an artist from repeat _ PHP Tutorial

Source: Internet
Author: User
Tags php template
Separate the artist to prevent duplication. If you are designing an interactive website, you will pay attention to two main issues: Art engineers and programs. This is also the most critical element behind a website's content during construction. if you are designing an interactive website, you will certainly pay attention to two main issues: Art engineers and programs. This is also the most critical factor for a website to get rid of its content during construction. There are usually two ways to coordinate the relationship between the artist and the program:
1. complete the art page first, and then the programmer directly embeds ASP, JSP, PHP, and other program code in the HTML file of the art page.
2. the artist and the program are both executed at the same time. However, because there is no page framework, the program can only make some key code. after both parties have completed the process, the engineer page and program code are embedded and merged again.
In the actual website construction process, due to personnel, progress, and other environmental restrictions, we usually use the above two coordination methods in a hybrid manner. However, both methods have shortcomings:
1. low efficiency. Poor coordination between the two may lead to waiting, repeated code debugging steps, and other phenomena;
2. poor debugging. Because the program code needs to be embedded in the HTML page, the Code embedding, debugging, and error correction are cumbersome;
3. inconvenient maintenance. Once the artist's design needs to be modified, such as the website revision, all the mixed pages of programs and HTML code must be rewritten;
If you are using a PHP program to build a website, congratulations, the PHP template technology will solve the above problems more satisfactorily.
So what is PHP template technology? PHP Template is the Template technology of PHPlib. it is one of the main modules in the PHPLIB Library and is developed from the Perl Template. PHPLIB is an extension of PHP. It provides many class libraries to easily implement basic functions such as user authentication and database encapsulation. We can download the latest phplib.netuse.de. To use the PHP template, you only need to unbind the template. inc file from the PHPLIB package and put it in the directory that our PHP program can call.
With the mysterious veil removed, the core concept of template technology is simple and heartbeat: to specify your art page as a template file, you only need to output the activity content on the page, such as the database, user interaction and other variables defined as {variable} are placed in the corresponding position in the template file. when the user browses, the PHP program file opens the template file, replace the variables defined in the template file with the dynamically generated content such as the corresponding database output or user interaction. for example:
Define the Template File: Mytemplate.html
The content of Mytemplte.html is:

  
.....
  
...
...
  
  
As we can see, in fact, a template file is a common HTML file, which contains the layout, art, and other elements you want, and the internal activity content exists in the form of variables, and wait for replacement. Obviously, it is meaningless to directly browse the template file because it does not contain any PHP program and all the content is "dead". now let's take a look at how to call the template, make it "active.

Bytes. This is also the most critical factor for a website to get rid of its content during construction...

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.