ASP Source Code: Mulvey Family Photo Album - getCaption.inc
<%
sub getCaption(cPath,cName,flg)
	'flg = 0	return first line only
	'flg = 1	return full text
	'flg = 2	return full text with first line as header
	on error resume next
	dim cap1
	dim FSO1
	Set FSO1 = CreateObject("Scripting.FileSystemObject")
	set cap1 = FSO1.OpenTextFile(cPath & "\" & cName & ".txt")
	if err.number = 0 then
		flag = true
		Caption = cap1.readLine
		if err.number = 0 then
			if Caption = "" then
				Caption = cName
			end if
		else
			Caption = cName
		end if
		if flg > 0 then
			if flg = 2 then
				Caption = "<h3>" & Caption & "</h3>"
			end if
			Body = cap1.ReadAll
			if err.number = 0 then
				if Body <> "" then
					toHTML
				end if
				if flg = 1 then
					Caption = Caption & "<br>" & Body
				else
					Caption = Caption & Body
				end if
			end if
		end if
		cap1.close()
	else
		Caption = cName
		if flg = 2 then
			Caption = "<h3>" & Caption & "</h3>"
		end if
		flag = false
	end if
	set cap1 = nothing
	set FSO1 = nothing
end sub
%>