Parts-File2Page

A classic ASP include file to read txt file of list into a page using bootstrap grid and fontawesome icons.
Used here in this website, (in Website Devlog and website Todos) it is a nice method to have simple dynamic pages without database.

Edit 2020-02-03: Enhanced and added ability to show count of lines, and ability to list file in reverse order, bottom line first.


Public

Tested

My Own Work
' What you need is:
' - The include file "Parts-File2Page.asp"
' - A text file having a list that will be converted into page, any extension, but should be simple ASCII file, example below.
' - Functions, all are available here, in this website
' - Then call it where you want to file to be displayed, simply with an include
' <%
' WholeLog   = ASCII2Read(SiteDevLogFile_URL, 2)
' ShowLinesCount = 0
' ShowBottomAtTop= 0
' %>
' <!-- #Include File = "Part-File2Page.asp" -->

' Parts-File2Page.asp : --------
<%
' WholeLog     = Already defined above as full content of file
' May also set ShowLinesCount = 1 to show number of lines at top
' ShowBottomAtTop = 1 to reverse order of file, make bottom line at top
' WholeLog     = ASCII2Read(SiteTodosFile_URL, 2)

OutputLines     = ""
OutputLinesCount   = 0
For Each DeDo in split(WholeLog, vbcrlf)
 OutputLinesCount  = OutputLinesCount + 1
 If DeDo = "" Then
 ElseIf DeDo = "'===='" Then
  If ShowBottomAtTop = 1 Then
   OutputLines  = "<div class=""row""><div class=""col""><hr/></div></div>" & vbcrlf & OutputLines
  Else
   OutputLines  = OutputLines & "<div class=""row""><div class=""col""><hr/></div></div>" & vbcrlf
  End If
 ElseIf DeDo = "" Then ' sometimes we had this at start of file, why?
 ElseIf Left(DeDo,1) = "'" Then
 Else
  DoSepa    = SepaCol
  If Instr(1, DeDo, SepaCol) = 0 Then DoSepa = "|"
  DoDate    = CutString3(DeDo, 1, DoSepa)
  DeDo1     = CutString3(DeDo, 2, DoSepa)
  If IsDate(DoDate) Then
   DoDate   = CDate(DoDate)
   DoFormat   = "mmm d ddd'yy"
   If Hour(DoDate) > 0 or Minute(DoDate) Then DoFormat = "mmm d ddd'yy HH:MM"
   DoDate = VB6Format(CDate(DoDate), DoFormat)
  End If
  If ShowBottomAtTop = 1 Then
   OutputLines  = "<div class=""row""><div class=""col-sm-2"">" & DoDate & "</div>" & vbcrlf & _
    "<div class=""col-sm-10""><i class=""" & DevLogSepaIcon & """></i> " & _
    Replace(DeDo1, SepaIL, "<i class=""" & DevLogSepaIcon & """></i>") & "</div></div>" & vbcrlf & OutputLines
  Else
   OutputLines  = OutputLines & "<div class=""row""><div class=""col-sm-2"">" & DoDate & "</div>" & vbcrlf
   OutputLines  = OutputLines & "<div class=""col-sm-10""><i class=""" & DevLogSepaIcon & """></i> "
   OutputLines  = OutputLines & Replace(DeDo1, SepaIL, "<i class=""" & DevLogSepaIcon & """></i>") & "</div></div>" & vbcrlf
  End If
 End If
Next
If ShowLinesCount = 1 Then
 OutputLines    = "<div class=""row""><div class=""col""> Lines: " & vbcrlf & OutputLinesCount & vbcrlf & "</div></div>" & vbcrlf & OutputLines
End If

%>
<div class="row"><div class="col">
 <%=OutputLines%>
</div></div>


' End of Parts-File2Page.asp : --------

' Example of "TextFile_WithList.txt" : --------
' 1 item per line
' Lines starts with ' are ignored
' Line having '====' is an hr
' Date {{$C$}} Body with multiple items, separated with {{$Sepa$}} .
'   OR
' Any title {{$C$}} Description.

Bug2 Oct 6'19{{$C$}} Table viewer (AJAX) part in Admin page is broken again.
Bug1 Oct 6'19{{$C$}} Linkedin login does not work for: {{$Sepa$}} DrVBA.com {{$Sepa$}} MyDevLib.com
'===='
Todo13 Oct 6'19{{$C$}} Make all domain redirects into ASP redirect (debug9.com)
Todo12 Oct 6'19{{$C$}} Website log into pages
' End of "TextFile_WithList.txt" : --------

<%
WholeLog = ASCII2Read(SiteDevLogFile_URL, 2)
ShowLinesCount = 0
ShowBottomAtTop= 0
%>

Views 751 Downloads 140

Classic ASP File System
ANmarAmdeen
693
Attachments
Revisions

v5.0