简体   繁体   中英

sceditor: How do I save and load data to/from mysql

I recently came across this BBCode (Bulletin Board Code) editor named SCEditor . It's the first one that I found so I started using this one, but i am not really familiar with parsers and stuff. I need it for showing news on my website. So basically:

  1. Admin types the news content using the editor.
  2. Now it gotta save (I don't know how to save its output (for example images?)).
  3. The main page loads it and shows as news (how do I load it and then convert to BBCode again?)

Here's the simple code i am using:

<form action="add-news.php" method="post">
    <input 
         type="text" 
         name="newssubject" 
         placeholder="Subject" 
         required="required field" 
         class="form-control" style="width: 98%">
    </input> <br>

    <textarea 
         id="newsenter" 
         cols="110" 
         rows="20" 
         name="newsbody">
    </textarea><br>

    <button 
         style="float:right; margin-right: 10px;" 
         type="submit" 
         name="newsset" 
         class="btn btn-success">
      Post
    </button>

    <a href="mod.php">
         <button 
              type="reset" 
              style="float:right; margin-right: 10px;" 
              class="btn btn-danger">
            Cancel
         </button>
    </a>
</form>


<script>
var textarea = document.getElementById('newsenter');
sceditor.create(textarea, {
    format: 'bbcode',
    style: 'minified/themes/content/default.min.css'
});
</script>

webpage image

You can use SBBCodeParser . SCEditor and this class were coded by the same person. So it would be more compatible.

from this answer : https://stackoverflow.com/a/17900286/5902691

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM