📄 index.asp
字号:
<%
Class ImplMocomWAPmoWAPIndex
Public Sub main()
If MyIO.Env("REQUEST_METHOD") = "POST" Then
Call doPost
Else
Call doGet
End If
End Sub
Private Sub doGet()
If ExportCache() Then Exit Sub
Dim MyAPI
Dim strName
Dim blnParse
Set MyXML = MyKernel.XMLParser
Set MyAPI = New ImplFactory
blnParse = False
MyXML.Title = MyKernel.Config("SiteName")
If MyKernel.Config("BackColor") <> "" Then
MyXML.Style("body") = "background-color:" & MyKernel.Config("BackColor")
End If
If MyKernel.Config("BackImage") <> "" Then
MyXML.Style("body") = "background-image:url(" & "images/backimage." & MyKernel.Config("BackImage") & ")"
End If
If MyKernel.Config("BackSound") <> "" Then
MyXML.Head.appendChild MyXML.CreateX("bgsound", GetPathName("images/backsound." & MyKernel.Config("BackSound")))
End If
Call SetCSS(MyKernel.Config("IndexCSS"))
strName = MyKernel.Config("Templet")
If strName = "" Then strName = GetIndexTemplet(1)
If strName <> "" Then blnParse = MyAPI.Parse(strName)
If Not blnParse Then
blnParse = MyAPI.ParseString(GetFileString(GetMapPath("templet/1.tpl"), "gb2312"))
End If
If blnParse Then
Call SetLog("index", 0)
If MyKernel.Config("CheckXHTML") = "1" Then
MyXML.TransformToObject "xhtml", GetMapPath("cache/index.xml")
MyXML.TransformToObject "wml", GetMapPath("cache/index.wml")
MyXML.TransformToObject "html", GetMapPath("cache/index.html")
Else
MyXML.TransformToObject "wml", GetMapPath("cache/index.wml")
End If
Call ExportCache
Else
MyXML.Println "模板解析错误,请稍后访问"
Call MyKernel.OutputXML(Empty)
End If
Set MyAPI = Nothing
End Sub
Private Sub doPost()
End Sub
Private Sub SetCSS(ByVal strData)
Dim reg, arr, ptr
Set reg = New RegExp
reg.Pattern = "([^{]+){([^}]+)}"
reg.Global = True
Set arr = reg.Execute(strData)
For Each ptr In arr
MyXML.Style(Trim(ptr.SubMatches(0))) = ptr.SubMatches(1)
Next
Set arr = Nothing
Set reg = Nothing
End Sub
Private Function ExportCache()
Dim strPath
Dim strTemp
Select Case MyKernel.NetType
Case "wap20"
strPath = GetMapPath("cache/index.xml")
Case "wap12"
strPath = GetMapPath("cache/index.wml")
Case "web"
strPath = GetMapPath("cache/index.html")
End Select
If Not fso.FileExists(strPath) Then
ExportCache = False
Else
strTemp = GetFileString(strPath, "UTF-8")
If strTemp = "" Then
ExportCache = False
Else
ExportCache = True
Response.Charset = "utf-8"
Response.ContentType = GetContentType()
Call FormatXML(strTemp)
End If
End If
End Function
Private Function GetContentType()
Select Case MyKernel.NetType
Case "wap20"
GetContentType = "application/vnd.wap.xhtml+xml"
Case "wap12"
GetContentType = "text/vnd.wap.wml"
Case "web"
GetContentType = "text/html"
End Select
End Function
Public Function newInstance()
Set newInstance = New ImplMocomWAPmoWAPIndex
End Function
End Class
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -