In ASP, the application of templates seems to be a new programming idea that emerged this year. In fact, many PHP programming ideas were used in the template idea a long time ago. The template mentioned here is not a template in C ++. The template mentioned in Web development is generally similar to the template in Dreamwaver, but it is actually different. Below I will illustrate the use of the template in ASP:
First of all, it is the creation of the template. Now I create a template to display my own data.
--------------------------
Nickname: {nickname} <BR>
Gender: {sex} <BR>
Hobbies: {fav} <BR>
Email: {email} <BR>
---------------------------
The above content can be directly assigned to a variable, saved to a file, or saved to a database. When used, the value is assigned to a variable. Here I set it to MyData, the following describes how to use a template:
--------------------------------
'Mydata is pre-assigned
MyData = Replace (MyData, "{nickname}", "L. J. Y .")
MyData = Replace (MyData, "{sex}", "male ")
MyData = Replace (MyData, "{fav}", "extensive ")
MyData = Replace (MyData, "{email}", "webmaster@tale99.com ")
---------------------------------
In this way, MyData is changed
Nickname: L. J. Y. <BR>
Gender: Male <BR>
Hobbies: extensive <BR>
Email: webmaster@tale99.com <BR>
How is it? Maybe you haven't felt the practicality of it, so you have to use it to fully understand how practical it is.
My suggestion is to save template data to data and read it later. You may say that reading template data from the database often consumes a lot of resources! Yes, but do you forget to have another Application? As long as you add a judgment, if there is no template data in the Application, you can not put it in it, which is actually very practical in large programs, because the Application is a shared object, even 10000 people use an Application, is it very economical.
Well, I just talked about my experience. Maybe this idea is really bad, or there are many places worth improving. Please give me some advice!
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.