ASP object: Template Operation class

Source: Internet
Author: User
Tags readfile
Object | template <%

’*************************************************************
' Please keep this declaration information when forwarding, this statement does not affect your speed!
’*************************************************************


’*************************************************************
' @author: Noodles
' @realname: Xu Renru
' @email: xurenlu@sohu.com
' @QQ: 55547082
' @Homepage: http://www.ksdn.net
' @ Copyright statement:
' Non-Profit groups or individuals are free to use.
’*************************************************************
I can guarantee this procedure by oneself completes independently, does not have the reference other people's any procedure (to refer to my own PHP version the template, but that also I independently completes.) At the same time I declare all the examples of this class copyright is my own, any person or entity entities may not be arbitrarily changed
' This template can be used for free:
' 1. Non-commercial application of the individual.
' 2. Charitable organizations such as the Red Cross, orphanages, etc.

' Specific use of the method please see example.asp file.

' Adsavecreateoverwrite

Class template
Dim adsavecreateoverwrite
Dim adsavecreatenotexist
Public Starttag
Public Endtag
public filename
Dim Key_arr ()
Dim Val_arr ()
Public content
Public total
Public Contenta ()
The contents of the public blockcontent ' block (parsed)
Public Block_begin_delim
Public Block_end_delim
Public Block_begin_word
Public Block_end_word
Public Block_null

Initialization of Sub Class_Initialize () ' Class
ReDim Key_arr (0)
ReDim Val_arr (0)
ReDim Contenta (0)
adsavecreateoverwrite=2
Adsavecreatenotexist=1

Starttag= "{"
Endtag= "}"
Total=0
Block_begin_word= "Begin"
Block_end_word= "End"
Block_begin_delim= "<!--"
Block_end_delim= "-->"
Block_null= "" ' begin and end separated by a space
End Sub


Sub Echo (a)
Response.Write A
End Sub


function ReadFile (filepath)
Dim stm2
On Error Resume Next
Set STM2 =server.createobject ("ADODB.") Stream ")
STM2. Charset = "gb2312"
STM2. Open
STM2. LoadFromFile filepath
ReadFile = stm2. ReadText
End Function


function WriteFile (filepath,str) ' Write to File
Dim stm
On Error Resume Next
Set stm = Server.CreateObject ("ADODB.") Stream ")
Stm. Charset = "gb2312"
Stm. Open
Stm. WRITETEXT Str
Stm. SaveToFile filepath, Adsavecreateoverwrite
End Function

function setfile (file) ' settings file, read file contents
Filename=file
Content=readfile (file)
End Function

Whether the function inarray (Val,arr) ' Val is in the array arr



Related Article

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.