📄 index.asp
字号:
<%
Class ImplMocomWAPmoWAPIndex
Public Sub main()
If Request.ServerVariables("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(" & FormatImg("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 "模板解析错误,请稍后访问"
MyXML.Transform Response
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.Env("XML_DOCTYPE")
Case "xhtml"
strPath = getMapPath("cache/index.xml")
Case "wml"
strPath = getMapPath("cache/index.wml")
Case "html"
strPath = getMapPath("cache/index.html")
End Select
strTemp = getFileString(strPath, "UTF-8")
If strTemp = "" Then
ExportCache = False
Else
ExportCache = True
Response.Charset = "utf-8"
Response.ContentType = MyKernel.Env("XML_CONTENTTYPE")
MyIO.Echo FormatXML(strTemp)
End If
End Function
Public Function newInstance()
Set newInstance = New ImplMocomWAPmoWAPIndex
End Function
End Class
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -