简体   繁体   English

场景编辑器:如何保存数据或从mysql加载数据

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

I recently came across this BBCode (Bulletin Board Code) editor named SCEditor . 最近,我遇到了一个名为SCEditor的 BBCode (公告板代码)编辑器。 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?) 主页将其加载并显示为新闻(如何加载,然后再次转换为BBCode?)

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 . 您可以使用SBBCodeParser SCEditor and this class were coded by the same person. SCEditor和此类由同一个人编码。 So it would be more compatible. 因此它将更加兼容。

from this answer : https://stackoverflow.com/a/17900286/5902691 从这个答案: https : //stackoverflow.com/a/17900286/5902691

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从sceditor textarea结果中删除标签 - How to remove tags from sceditor textarea result 如何从MySQL数据库中提取数据以在页面加载时预先填充表单? - How do I pull data from my MySQL database to pre populate a form on page load? 从 SCEditor 获取值 - Get the value from SCEditor 如何创建“另存为”和“加载”对话框以在javascript中创建/加载json文件/数据? - How do I create “save as” and “load” dialogs to create/load json files/data within javascript? 如何保存 model.find({}) function 中的数据? - How do I save data from a model.find({}) function? 如何将复选框数组中的数据保存到数据库中 - How do I save data from a checkbox array into database 如何从服务器渲染的HTML将数据加载到模型中 - How do I load data into models from server rendered html 如果我没有从javascript返回任何数据到Node.js提取调用,是否可以节省服务器和客户端的负载? - Do I save on server & client load if I don't return any data from a javascript to Node.js fetch call? 如何使用 javascript 将 html 表单中的数据保存到 mysql 数据库中? - How do you save data from an html form to a mysql database using javascript? 如何从 MySQL 以键和值对的形式返回数据 - How do I return data as a Key & Value pair from MySQL
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM