如何将数据库中的值回显到基于wysiwyg的引导程序中 [英] How to echo value from database into a bootstrap based wysiwyg

查看:86
本文介绍了如何将数据库中的值回显到基于wysiwyg的引导程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个cms,我能够通过wysiwyg插入到数据库中,但当我想编辑上一篇文章时,我加热编辑就像它带我到我的编辑页面但是wysiwyg里面的值没有出现但是每一个其他的工作正在工作





am building a cms,i was able to insert into database with wysiwyg but when i want to edit previous post when i heat the edit like it take me to my edit page but the value inside the wysiwyg does not show up but every other thing is working


<blockquote class="quote"><div class="op">Quote:</div>

<script src="plugins/WYSIWYG/editor.js"></script>

<script type="text/javascript">
	$(document).ready( function() {
	$("#txtEditor").Editor();
	var textareaValue= $("#txtEditor").code();
	
	});
	</script>
	
	
	<script>
	$(document).on("click", ".txtEditor", function () {
     var myBookId = $(this).data('id');
     $(".modal-body #bookId").val( myBookId );
     // As pointed out in comments, 
     // it is superfluous to have to manually call the modal.
     // $('#addBookDialog').modal('show');
});
	</script>
<form name="my_form" action="action.php" method="POST"  enctype="multipart/form-data">
  <div class="form-group">
    <label for="exampleInputEmail1">Date</label>
    <input type="text" class="form-control" id="time" name="time"  value="" disabled>
    <small id="emailHelp" class="form-text text-muted"></small>
  </div>
  <div class="form-group">
    <label>Article Title</label>
    <input type="text" class="form-control" id="title" name="title" value="" placeholder="title" required />
  </div>
  <div class="form-group">
    <label >select categories</label>
    <select class="form-control" id="cat" name="cat">
      <option value="World">World</option>
 <option value="Sport">Sport</option>
 <option value="Politics">Politics</option>
 <option value="Business">Business</option>
 <option value="Technology">Technology</option>
 <option value="Entertainment">Entertainment</option>
 <option value="Fashion">Fashion</option>
 <option value="Gist">Gist</option>    </select>
  </div>
  
  <div class="form-group">
    <label>Write Article </label>
    <textarea class="form-control" id="txtEditor" name="txtEditor" value=""  rows="3"></textarea>
  </div>
  <div class="form-group">
    <label for="exampleInputFile">upload image</label>
    <input type="file" accept="image/*" name="myimage" id="myimage" class="form-control-file" id="exampleInputFile" aria-describedby="fileHelp">
    <small id="fileHelp" class="form-text text-muted"></small>
	
  </div>
  
  <button onclick=" $('#txtEditor').val($('.Editor-editor').html());" type="Publish" id="Publish" name="Publish" class="btn btn-primary">Publish</button>
</form></blockquote>





我的尝试:



这里到目前为止已经尝试了



What I have tried:

here is what have tried so far

推荐答案

文档 function (){
(document).ready( function() {


#txtEditor)。Editor();
var textareaValue =
("#txtEditor").Editor(); var textareaValue=


#txtEditor)码();

});
< / script >


< script >
("#txtEditor").code(); }); </script> <script>


这篇关于如何将数据库中的值回显到基于wysiwyg的引导程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆