ASP Classic blog framework - BrainOrdure
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

161 líneas
5.8KB

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

Powered by TurnKey Linux.