ASP Classic blog framework - BrainOrdure
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

141 wiersze
4.3KB

  1. <article class="card shadow-sm mb-4">
  2. <div class="card-body">
  3. <div class="mb-3">
  4. <a href="<%= PostsUrl() %>" class="small text-decoration-none">&larr; Back to posts</a>
  5. </div>
  6. <h1 class="h2 mb-2"><%= H(post.Title) %></h1>
  7. <%
  8. Dim publishedText
  9. publishedText = ""
  10. If IsDate(post.PublishedDate) Then
  11. If CDate(post.PublishedDate) > #1/1/1970# Then
  12. publishedText = FormatDateTime(post.PublishedDate, vbLongDate)
  13. End If
  14. End If
  15. If Len(publishedText) > 0 Then
  16. %>
  17. <p class="text-muted"><%= H(publishedText) %></p>
  18. <%
  19. End If
  20. Dim postBody
  21. postBody = H(post.Body)
  22. postBody = Replace(postBody, vbCrLf, "<br>")
  23. postBody = Replace(postBody, vbCr, "<br>")
  24. postBody = Replace(postBody, vbLf, "<br>")
  25. %>
  26. <div class="fs-5 lh-lg"><%= postBody %></div>
  27. </div>
  28. </article>
  29. <!-- Comments -->
  30. <section class="mt-2">
  31. <%
  32. Dim commentsCount, commentsLoadFailed
  33. commentsCount = 0
  34. commentsLoadFailed = False
  35. On Error Resume Next
  36. If IsObject(comments) Then commentsCount = comments.Count
  37. If Err.Number <> 0 Then
  38. commentsLoadFailed = True
  39. commentsCount = 0
  40. Err.Clear
  41. End If
  42. On Error GoTo 0
  43. %>
  44. <h2 class="h4 mb-3">Comments (<%= commentsCount %>)</h2>
  45. <% If commentsLoadFailed Then %>
  46. <div class="alert alert-warning mb-4">Comments are temporarily unavailable.</div>
  47. <% ElseIf commentsCount = 0 Then %>
  48. <p class="text-muted mb-4">No comments yet. Be the first to leave one below.</p>
  49. <% Else %>
  50. <%
  51. Dim commentIter, commentItem
  52. Dim commentsIterFailed
  53. commentsIterFailed = False
  54. On Error Resume Next
  55. Set commentIter = comments.Iterator()
  56. If Err.Number <> 0 Then
  57. commentsIterFailed = True
  58. Err.Clear
  59. End If
  60. Do While Not commentsIterFailed And commentIter.HasNext
  61. Set commentItem = commentIter.GetNext()
  62. If Err.Number <> 0 Then
  63. commentsIterFailed = True
  64. Err.Clear
  65. Exit Do
  66. End If
  67. Dim commentDateText
  68. commentDateText = ""
  69. If IsDate(commentItem.CreatedDate) Then
  70. commentDateText = FormatDateTime(commentItem.CreatedDate, vbLongDate)
  71. End If
  72. %>
  73. <div class="card shadow-sm mb-3">
  74. <div class="card-body">
  75. <div class="d-flex justify-content-between mb-2">
  76. <strong class="small"><%= H(commentItem.AuthorName) %></strong>
  77. <span class="small text-muted"><%= H(commentDateText) %></span>
  78. </div>
  79. <%
  80. Dim commentBody
  81. commentBody = H(commentItem.Body)
  82. commentBody = Replace(commentBody, vbCrLf, "<br>")
  83. commentBody = Replace(commentBody, vbCr, "<br>")
  84. commentBody = Replace(commentBody, vbLf, "<br>")
  85. %>
  86. <p class="mb-0"><%= commentBody %></p>
  87. </div>
  88. </div>
  89. <%
  90. Loop
  91. If Err.Number <> 0 Then
  92. commentsIterFailed = True
  93. Err.Clear
  94. End If
  95. On Error GoTo 0
  96. If commentsIterFailed Then
  97. %>
  98. <div class="alert alert-warning mb-4">Some comments could not be displayed.</div>
  99. <%
  100. End If
  101. %>
  102. <% End If %>
  103. <!-- Comment form -->
  104. <div class="card shadow-sm mt-4">
  105. <div class="card-body">
  106. <h3 class="h5 mb-3">Leave a Comment</h3>
  107. <form method="post" action="<%= CommentsUrl() %>">
  108. <input type="hidden" name="PostID" value="<%= H(post.PostID) %>">
  109. <input type="hidden" name="PostSlug" value="<%= H(post.Slug) %>">
  110. <div class="mb-3">
  111. <label class="form-label" for="AuthorName">Name <span class="text-danger">*</span></label>
  112. <input class="form-control" type="text" id="AuthorName" name="AuthorName" required>
  113. </div>
  114. <div class="mb-3">
  115. <label class="form-label" for="AuthorEmail">Email <span class="text-muted small">(optional, not displayed)</span></label>
  116. <input class="form-control" type="email" id="AuthorEmail" name="AuthorEmail">
  117. </div>
  118. <div class="mb-3">
  119. <label class="form-label" for="Body">Comment <span class="text-danger">*</span></label>
  120. <textarea class="form-control" id="Body" name="Body" rows="4" required></textarea>
  121. </div>
  122. <button class="btn btn-primary" type="submit">Submit Comment</button>
  123. <p class="small text-muted mt-2 mb-0">Comments are reviewed before appearing.</p>
  124. </form>
  125. </div>
  126. </div>
  127. </section>

Powered by TurnKey Linux.