My template analysis engine class PHP. NET development method-label design

Source: Internet
Author: User

When designing my own template analysis class, the first question I encountered was how to design my own tag syntax. After referring to and comparing many label representations, I decided to use the label representations of class. Net controls. Because I think this is the only way. net programmers can quickly get familiar with these things, rather. net programmers will not be too difficult to learn, because they generally have a good grasp of the basic technology, as long as a little talk to understand what is going on.
After analyzing the syntax of the. NET control, I found that it only has three syntax representations:
1. <asp: Label id = "III"/>
2. <asp: Label id = "III"> </ASP: Label>
3. <itemtemplate> </itemtemplate>
After analysis and summary, I have implemented the following three tag forms:
1. {label ID}
2. {view ID} {/view}
3. {itemtemplate} {/itemplate}
Does it look like it? Yes, basically there is no difference. I just replaced <> with {}, changed key = "value" directly to key, and removed the cursor behind the simple tag. This is why {} is not used <> because <> is the most commonly used symbol in HTML code, and the usage of {} is relatively small, which can save a lot of time for the analysis program. Remove key = "value" and replace it with key because I think I only need one key, that is, the Control ID. According to the current usage, this assumption is basically true.
According to the above label design, {label ID} is a simple label, and {itemtemplate} {/itemplate} is a closed tag, {view ID} {/view} is a complex tag. A complex tag can have a closed tag and a simple tag, but a closed tag can only exist in a complex tag, but it can have a simple tag and other complex Tags inside it, no other labels exist in a simple tag. A control can be a complex tag or a simple tag, but it cannot only be a closed tag. For example, {view ID} {/view} is a control, and {repeater ID} {itemtemplate} {/repeater} is also a control, however, {itemplate} {/itempalte} is not a control.
With the above label format and limitation specifications, my analysis program is easier to write. The first thing I need to do is to analyze the information of each label and its coordinates and put them in the list. This is what my analysis program does. With this information, building your own controls is nothing more than making it easy. The specific method is simply to combine the tags to implement a control.

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.