Vbscript|vbscript Now the code is somewhat less practical than we want, we'll use class Tvprogram on other pages, so it's best to define it separately so that all faces can be invoked. Create an ASP page and name it tvprogramclass.asp, where we define class Tvprogram.
--tvprogramclass.asp--
<%
Class Tvprogram
Private Internal_starttime
Public Property Get StartTime
StartTime = Hour (internal_starttime) & _
":" & Minute (Internal_starttime)
End Property
Public Property Let StartTime (ByVal Vartimein)
If IsDate (Vartimein) Then
Internal_starttime = Vartimein
End If
End Property
Private internal_programdate
Public Property Get Programdate
Programdate = Day (internal_programdate) & _
"" & MonthName (Month (internal_programdate)) & _
"" & Year (Internal_programdate)
End Property
Public Property Let Programdate (ByVal Vardatein)
If IsDate (Vardatein) Then
Internal_programdate = Vardatein
End If
End Property
Public Programtitle
End Class
%>
This allows you to call our defined classes in any ASP, as follows:
<!--#include virtual= "tvprogramclass.asp"-->
<%
Dim Objtvshow
Set objtvshow = New Tvprogram
Objtvshow.starttime = CDate ("17:30")
Objtvshow.programdate = DateSerial (1999,9,17)
Objtvshow.programtitle = "The Jerry Springer Show"
%>
<%= Objtvshow.programtitle%> is on in <%= objtvshow.starttime%> on <%= objtvshow.programdate%>.
Here's a suggestion. If you rename your include file. asp, and ensure that all important code is in <code><% ...%>< code>, then even if someone guessed the file name you included, you can't see the contents!