In-depth analysis of fastm design ideas

Source: Internet
Author: User
1. PHP (fastm) cut the document into a simple DOM structure. the design idea of the PHP template is very beautiful. Use Begin and End in the comment to put HTML (WML, or any XML) the page is cut into different blocks, and the blocks can be continuously cut. In this way, a page

1. PHP (& fastm) cut the document into a simple DOM structure

The PHP template design idea is very beautiful. Use Begin and End in the annotation to cut HTML (WML, or any XML) pages into different blocks, and the blocks can be continuously cut.

In this way, a page is cut into a tree structure, like a DOM structure. It's just that the DOM structure is too dumb. a node must be created for each element, and the node type is very complex. For example, if an html dom structure contains multiple types of HTML elements, such as Body, Table, TR, TD, Form, and Input.

The PHP template is a lightweight DOM structure, and a Begin-End block is a node. The Begin-End block contains only three types of content: static text, variables, and other Begin-End blocks.

The design concept is so concise, strong, easy to use, and Universal (it can be used in any standardized or nonstandard XML page, such as HTML, WML, or even XUL, XAML), and, what you see is what you get in the HTML editor. Throughout the world of template skills, do not find its right.

I have been suffering from various Java page skills. after being introduced by my colleagues, I am familiar with the PHP template skills. I am so glad to be surprised that I had such a good thing. I hate to know each other too late.

The idea of Fastm template is complete, and the idea of PHP template authentication is only slightly extended. (For more information, see my previous article about JDynamiTe-Java page tips ).

The BEGIN-end dynamic Block of the Fastm template is equivalent to the PHP in-End block of the PHP template.

The BEGIN-end ignored block of the Fastm template is equivalent to the neglected Begin-End block of the PHP template.

For example, the following HTML snippet.

     

We can see that this segment contains a BEGIN-END block (zipcodes), which contains two identical variables, and the other parts are static text.

The fastm Template DOM structure of this fragment is as follows:

Static textDynamic chunk zipcodes --| --- Static text| --- Variable| --- Static text ">| --- Variable

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.