ASP Classic blog framework - BrainOrdure
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

142 satır
4.5KB

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

Powered by TurnKey Linux.