Subversion Repositories DevTools

Rev

Rev 119 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
119 ghuddy 1
<%
2
'=============================================================
3
'//
4
'//						TemplateManager
5
'//
6
'// version: 		0.0.1
7
'//	last modified: 	01-Feb-2004 11:00 by Sasha Vukovic
8
'=============================================================
9
%>
10
<%
11
' Template Requirement:
12
'  - Each element path must be unique
13
'  - Element names can only contain characters [A-Z] [0-9]
14
'  - Each element must finish with "_END" appended to the element name
15
'
16
'
17
' Template Sample:
18
' <!-- StyleWinXP -->
19
'	<!-- PreTabsCode -->
20
'	<table width="10"  border="0" cellspacing="0" cellpadding="0">
21
'		<tr>
22
'	<!-- PreTabsCode_END -->		
23
'	<!-- TabSelected -->
24
'			<td background="images/bg_tab.gif"><img src="images/p_tab_l.gif" width="3" height="24"></td>
25
'			<td align="center" nowrap background="images/bg_tab.gif" class="menu_txt">&nbsp;&nbsp;&nbsp;&nbsp;%TEXT%&nbsp;&nbsp;&nbsp;&nbsp;</td>
26
'			<td align="right" background="images/bg_tab.gif"><img src="images/p_tab_r.gif" width="3" height="24"></td>
27
'			<td><img src="images/spacer.gif" width="5" height="10"></td>
28
'	<!-- TabSelected_END -->
29
' <!-- StyleWinXP_END -->
30
%>
31
<%
32
Class TemplateManager
33
 
34
	Public mTemplateDoc
35
 
36
 
37
	Public Property Let TemplateDoc( sTemplate ) 
38
		mTemplateDoc = sTemplate
39
 
40
	End Property 
41
 
42
 
43
 
44
	'-----------------------------------------------------------------------------------------------------------------
45
	Public Function getElementValue ( ByVal sStyleId )
46
		' StyleId can also be path. e.g. StyleWinXP/PreTabsCode
47
		Dim PosStart, PosEnd, PosCurr, arrElementPath, element
48
 
49
		' Remove first slash "/" if present
50
		If InStr( sStyleId, "/" ) = 1 Then sStyleId = Right ( sStyleId, Len( sStyleId ) - 1 )
51
 
52
 
53
		arrElementPath = Split( sStyleId, "/" )
54
		PosCurr = 1
55
		For Each element in arrElementPath
56
			PosStart = InStr( InStr( PosCurr, mTemplateDoc, element ), mTemplateDoc, ">" ) + 1 
57
			PosCurr = PosStart
58
			sStyleId = element
59
		Next
60
 
61
		PosEnd	 = InStrRev( mTemplateDoc, "<!--", InStr( PosStart, mTemplateDoc, sStyleId &"_END" ) )
62
 
63
		getElementValue = Mid ( mTemplateDoc, PosStart, PosEnd - PosStart )
64
 
65
	End Function
66
	'-----------------------------------------------------------------------------------------------------------------
67
	Private Sub Class_Initialize()
68
		'// Perform action on creation of object. e.g. Set myObj = New ThisClassName
69
	End Sub
70
	'-----------------------------------------------------------------------------------------------------------------
71
	Private Sub Class_Terminate()
72
		'// Perform action on object disposal. e.g. Set myObj = Nothing
73
	End Sub
74
	'-----------------------------------------------------------------------------------------------------------------
75
End Class
76
%>