发布面板,如codeproject.com [英] posting panel like codeproject.com

查看:79
本文介绍了发布面板,如codeproject.com的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想提出一个问题发布面板,就像一个代码项目。我搜索了很多,但这个想法对我来说并不清楚。



当用户在代码项目上发布问题然后它肯定保存到数据库中,现在在这种情况下几乎每个用户都把代码放在他的问题中,所以我的问题是:保存代码如php或js或HTML是一个糟糕的设计,如许多线程所述,所以什么类型的方法/技术代码项目使用哪些不影响数据库。



第二件事是:当用户制作/样式文本粗体或斜体或放置代码块时,则确定文本以正常格式保存在数据库中,因此,不同论坛使用何种类型的技术/方法来获取与用户选择的相同的样式文本。



我只需要基本的想法/示例链接或示例代码,以实现我的目标。



任何帮助/想法将不胜感激。



谢谢。

解决方案

其实您所寻找的是, WYSISWYG [ ^ ]。它使您能够以所需的格式编写文档,然后底层格式将其转换为文本格式,如大多数软件应用程序中的富文本格式或Word格式。在Web应用程序中,不使用这些格式,因此使用基于JavaScript或CSS的编辑器,就像这样。



在CodeProject的论坛编辑器中,使用了JavaScript和/或CSS。你用HTML写它,然后你把它发送到他们的服务器,他们做一些其他的渲染,如语法高亮和其他一些模式,如删除亵渎等。然后内容存储在数据库中供用户查看HTML的。注意:现在支持Markdown,允许我们使用特殊字符而不是HTML元素。 阅读Chris的这篇文章了解更多 [ ^ ]。



另一方面,CodeProject上的文章编辑器默认使用WYSIWYG,你不必编写HTML元素也不必编写降价字符。您只需编写它然后使用提供的UI即可更改格式和其他图形内容。 Google上已经有很多类似的内容, WYSIWYG编辑 [ ^ ]。



其次,您添加的内容会影响数据库,因为它的大小会增加。谁说不呢?你是说他们对每一次输入都是安全的吗?然后他们确实使用安全措施,我的意思是数据库团队知道数据库对潜在用户的暴露程度,因此他们将尽力确保在服务器上不会触发可能导致事故的此类有害命令。

I want to make a question posting panel like the one code project. i search a lot but the idea is not clear for me.

when a user post question on code project then it surely save into the database, now in that case almost every user put code in his question, so my question here is that:saving code like php or js or HTML is a bad design as mentioned in many threads, so what type of approach/techniques code project use which don't effect the data base.

second thing is: When user make/style the text bold or italic or put code block, then it is sure that the text is save in normal format in database,so what type of technique/approach use by the different forums to get the same style text as user selected.

I just need the basic idea/example link or example code, to achieve my goal.

Any help/idea will be appreciated.

Thanks.

解决方案

Actually what you are looking for is known as, WYSISWYG[^]. It enables you to write the document in a format that you want and then the underlying format converts it a format for the text, such as Rich-text format or Word format like in most software applications. In web applications those formats are not used, so JavaScript or CSS based editors are used, like this one.

In CodeProject's forum editors, JavaScript and/or CSS is used. You write it in HTML and then you send it to their servers, they do some other rendering such as syntax highlighting and other few moderations, such as profanity removal etc. Then the content is stored in the database for users to review the HTML of that. Note: Markdown is now supported that allows us to use special characters instead of HTML elements. Read this post by Chris for more[^].

Now on the other hand, the article editor on CodeProject uses the WYSIWYG by default, you don't have to write the HTML elements nor you have to write the markdown characters. You just write it and then using the provided UI you can change the formatting and other graphical stuff. A lot of similar stuff is already available on Google, under WYSIWYG editors[^].

Secondly, the content you are adding does affect database, as it grows in size. Who said it doesn't? Did you mean that they are safe for every input? Then they do use security measure, I mean the database team knows how much exposed the database is to potential users, so they will try their best to ensure that no such harmful commands are triggered on the server that might cause an accident.


这篇关于发布面板,如codeproject.com的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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