<% SnippetFolder = request("SnippetFolder") 'SnippetFolder = "/Public/Snippets" SnippetFileName = "snippets.xml" if right(SnippetFolder,1)<>"/" then SnippetFolder = SnippetFolder & "/" end if SnippetPath = server.MapPath(SnippetFolder & SnippetFileName) 'response.Clear() 'response.write SnippetPath 'response.End() set Fs = server.CreateObject("Scripting.FileSystemObject") VerifyFileExists() Dim objSnippets set objSnippets = getSnippetsList() function getSnippetsList() dim objXML on error resume next Set objXML = Server.CreateObject("Microsoft.XMLDOM") if err <> 0 then response.Clear() response.write "You need XML services installed on this server...See http://www.microsoft.com/xml for more information..." response.end end if on error goto 0 objXML.validateOnParse = True objXML.async = False objXML.load(SnippetPath) set getSnippetsList = objXML.getElementsByTagName("Snippets") set objXML = nothing end function function VerifyFileExists() if not Fs.FileExists(SnippetPath) then set myFile = Fs.OpenTextFile(SnippetPath,2,true) myFile.writeLine("" & vbcrlf) myFile.writeLine("" & vbcrlf) myFile.writeLine("" & vbcrlf) myFile.close set myFile = nothing end if end function %>
Please select the snippet to insert:
<% if objSnippets(0).childNodes.length > 0 then %>
<% for J=0 to objSnippets(0).childNodes.length - 1 %> <% next %>
<%=objSnippets(0).childNodes(J).getAttribute("title")%>
<%=objSnippets(0).childNodes(J).childNodes(0).text%>
Modify/Delete snippet
<% end if %> <% if objSnippets(0).childNodes.length < 1 then %>

(No snippets defined)
<% end if %>