Answer the question
In order to leave comments, you need to log in
BB codes are stored in the database and HTML is generated from them with each request, or is HTML stored?
How expensive is it to generate HTML code in PHP from simple BB codes (B, I, U, S, URL, IMG, QUOTE)? How many average forum posts per second can be converted to HTML on an average modern 1-core shared hosting, without using ready-made HTML caches? Who has decision statistics: is the BB code always stored in the database? Are there solutions where the BB code is parsed when posting, the BB code is forgotten and only HTML is stored? Are there any solutions for parsing the BB code in the client's Javascript - is it cool, is it flawed?
I always thought that they store the BB code in the database, render HTML on the fly, and in hard times use some kind of memcash, until they talked about the forum engine, where the BB code is forgotten after posting and then only HTML is stored.
Answer the question
In order to leave comments, you need to log in
Here, in general, three approaches can be distinguished:
1. Store the source code in the database and form it on the fly
2. Cache the processed text with each change. For example, in an adjacent field in a database record or in any kind of cache.
3. Keep only processed text. Suitable if it never changes after pasting.
Concerning conversion - depends on volumes. Ordinary posts on an average forum, for example, are not very expensive to convert on the fly. And if you have huge sheets there, then you can cache (or convert it once, when you don’t need to change it).
Oh my God! Are you still using BB Codes??? Time to switch to Markdown.
And on the subject, Alexey Skobkin answered you well
talked about the forum engine, where the BB code is forgotten after posting and then only HTML is stored.obviously a crazy idea
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question