允许用户创建页面
I would like to allow users to create pages on my site. Not full pages, but just content for the default template.
I am currently using http://ckeditor.com/ then saving the content into a database.
Is this the best way to go about doing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这太模糊了。为用户提供编辑器然后将内容保存在数据库中是最好的方法吗?当然。事实上,很难想出任何其他合理的方法。
CKEditor 是最好的编辑器吗?这取决于您和您的用户。 Stack Overflow 使用一个带有一些按钮的简单文本区域来添加 Markdown 代码。这效率更高,但非技术用户会讨厌它。我个人倾向于使用 TinyMCE,许多用户通过在 WordPress 中使用它而认识到它。
哪种编辑器适合您的网站取决于您和您的用户。
至于将其保存在数据库中,您还可以将其放在哪里?显然,您必须将访问者写入的内容保存在某种数据库中。
您询问的是一些非常非常广泛的决策,这些决策几乎不属于此类解决方案的“最佳实践”。更有趣的问题是:它如何保存在数据库中,如何控制谁有权访问,如何跟踪以前的版本,如何验证要显示的内容,如何防止多个用户覆盖彼此的编辑,用户如何从查看页面转到编辑页面?
That's awfully vague. Is giving users an editor and then saving the content in a database the best approach? Sure. In fact, it'd be hard to come up with any other reasonable approach.
Is CKEditor the best editor? That's up to you and your users. Stack Overflow uses a simple textarea with some buttons to add markdown code. That's far more efficient, but non-technical users would hate it. I personally tend to use TinyMCE which many users recognize from its use in WordPress.
Which editor is right for your site depends on you and your users.
And as far as saving it in a database, where else could you put it? Obviously you'll have to save what the visitors write in a database of some kind.
You're asking about some very, very broad decisions that are hardly part of the "best practice" for this sort of solution. More interesting questions are: how is it saved in the database, how do you control who has access, how do you keep track of previous versions, how do you validate which content to display, how do you prevent multiple users from overwriting each other's edits, how do users get from viewing the page to editing the page?
也许使用像 Simple CMS 这样的东西会更容易(而且更安全、更漂亮等) ?
Perhaps it would be easier (and safer, and prettier, etc.) to use something like Simple CMS?