Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.
Posted
Updated 30-Aug-15 13:41pm
v2

1 solution

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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900