content.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <extend name="Public:base" />
  2. <block name="content">
  3. <section class="container" id="blog_content">
  4. <div class="container">
  5. <div class="row">
  6. <div class="col-md-9">
  7. <div class="row">
  8. <header class="col-md-12 ">
  9. <h3 class="tac">{$content.title}</h3>
  10. </header>
  11. </div>
  12. <div class="clearfix">
  13. <volist name="images" id="i" >
  14. <div class="col-md-12 center-block">
  15. <img class="img-thumbnail" src="__ROOT__/Uploads/image/{$i.image}" />
  16. <p class="tac">{$i.title}</p>
  17. </div>
  18. </volist>
  19. </div>
  20. <div id="blog-content" class="well">
  21. <?php echo htmlspecialchars_decode($content['content']); ?>
  22. </div>
  23. <?php if($content['allow_reply']==1){ ?>
  24. <div id="reply">
  25. <h5>全部留言</h5>
  26. <div id="reply_content">
  27. <ol class="comments first_level">
  28. <volist name="reply" id="r">
  29. <li>
  30. <article class="comment_box commentbox1">
  31. <div class="gravatar">
  32. <img src="__IMG__/1.jpg" alt="author 6" />
  33. </div>
  34. <div class="comment_text">
  35. <div class="comment_author">{$r.title} <span class="date">{$r.create_time}</span></div>
  36. <p style="text-align: justify;">{$r.content}</p>
  37. <div class="reply"><a href="#comment" class="re" style="cursor:pointer;" author="{$r.title}">回复</a></div>
  38. </div>
  39. <div class="clearfix"></div>
  40. </article>
  41. </li>
  42. </volist>
  43. </ol>
  44. </div>
  45. <div id="comment_form">
  46. <h5>写下留言</h5>
  47. <form name="comment" id="validation-form">
  48. <div class="form-group">
  49. <label>名字</label>
  50. <div class="clearfix">
  51. <input name="name" id="name" class="form-control" type="text" maxlength="30" />
  52. </div>
  53. </div>
  54. <div class="form-group">
  55. <label>邮箱 (* 必填 但不会公开)</label>
  56. <div class="clearfix">
  57. <input name="email" id="email" class="form-control" type="text" maxlength="30" />
  58. </div>
  59. </div>
  60. <div class="form-group">
  61. <label>你的留言</label><br />
  62. <div class="clearfix">
  63. <textarea cols="5" rows="8" class="form-control" id="comment" name="comment"></textarea>
  64. </div>
  65. </div>
  66. <a style="margin:10px 0;" id="submit" type="submit" class="btn btn-warning">提交</a>
  67. </form>
  68. </div>
  69. </div>
  70. <?php } ?>
  71. </div>
  72. {~W('BlogCategory/blog_category_show')}
  73. </div>
  74. </div>
  75. </section>
  76. </block>
  77. <block name="foot_script">
  78. <?php if($content['allow_reply']==1){ ?>
  79. <script src="__PUBLIC__/js/jquery.validate.min.js"></script>
  80. <script>
  81. var verifyimg = $(".verifyimg").attr("src");
  82. $(".reloadverify").click(function(){
  83. if( verifyimg.indexOf('?')>0){
  84. $(".verifyimg").attr("src", verifyimg+'&random='+Math.random());
  85. }else{
  86. $(".verifyimg").attr("src", verifyimg.replace(/\?.*$/,'')+'?'+Math.random());
  87. }
  88. });
  89. $('.re').on('click', function() {
  90. var title='回复 '+$(this).attr('author');
  91. $('#name').val(title);
  92. });
  93. $('#submit').click(function(){
  94. if($("#validation-form").valid()){
  95. $.getJSON("{:U('/reply')}",{
  96. name:$('#name').val(),
  97. email:$('#email').val(),
  98. comment:$('#comment').val(),
  99. id:'{$Think.get.id}'
  100. }, function(data){
  101. $("#reply_content").load("{:U('/replys/'.$_GET['id'])}");
  102. //$(".reloadverify").trigger('click');
  103. });
  104. }
  105. });
  106. $('#validation-form').validate({
  107. errorElement: 'div',
  108. errorClass: 'help-block',
  109. focusInvalid: false,
  110. rules: {
  111. name: {
  112. required: true
  113. },
  114. email: {
  115. required: true
  116. },
  117. comment: {
  118. required: true
  119. },
  120. verify: {
  121. required: true,
  122. remote : {
  123. url :"{:U('/check_verify')}",
  124. type:'get',
  125. data:{
  126. verify : function(){
  127. return $('#verify').val();
  128. }
  129. }
  130. }
  131. }
  132. },
  133. messages: {
  134. name: {
  135. required: "必填"
  136. },
  137. email: {
  138. required: "必填"
  139. },
  140. comment: {
  141. required: "必填"
  142. },
  143. verify: {
  144. required: "必填",
  145. remote : '验证码错误'
  146. }
  147. },
  148. invalidHandler: function (event, validator) { //display error alert on form submit
  149. $('.alert-danger', $('.login-form')).show();
  150. },
  151. highlight: function (e) {
  152. $(e).closest('.form-group').removeClass('has-info').addClass('has-error');
  153. },
  154. success: function (e) {
  155. $(e).closest('.form-group').removeClass('has-error').addClass('has-info');
  156. $(e).remove();
  157. },
  158. errorPlacement: function (error, element) {
  159. error.insertAfter(element.parent());
  160. },
  161. });
  162. </script>
  163. <?php } ?>
  164. </block>