vb Get Theme File
Function ThemeFile(strFile) 'thanks to: http://www.motobit.com/tips/detpg_read-write-binary-files/ Dim strReturn Dim BinaryStream Dim strFilePath Dim objFSO, bFileExists 'theme files are HTML strFile = strFile & ".html" strFilePath = Server.MapPath("/themes/" & Application("Theme") & "/" & strFile) 'determine if the file exists Set objFSO = Server.CreateObject("Scripting.FileSystemObject") If objFSO.FileExists(strFilePath) Then bFileExists = true Else bFileExists = false End If Set objFSO = Nothing If bFileExists = true Then 'create Stream object Set BinaryStream = CreateObject("ADODB.Stream") 'specify stream type - we want to get binary data. BinaryStream.Type = 2 'specify charset for the source text (unicode) data 'see: http://msdn.microsoft.com/en-us/library/ms526296(EXCHG.10).aspx for full list of CharSets BinaryStream.CharSet = "utf-8" 'open the stream BinaryStream.Open 'load the file data from disk To stream object BinaryStream.LoadFromFile strFilePath 'open the stream And get binary data from the object strReturn = BinaryStream.ReadText Set BinaryStream = Nothing Else 'return an empty string strReturn = "" End If 'return string of file contents ThemeFile = strReturn End Function
Gets the contents of a HTML file for use within a themes system - within slickcms, but not yet implemented.
Updated: Saturday 9th October 2010, 02:43pm
There are 0 comments
Comments are currently closed.