P
P
pavelkolodin2016-10-19 14:05:06
PHP
pavelkolodin, 2016-10-19 14:05:06

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

3 answer(s)
A
Alexey Skobkin, 2016-10-19
@skobkin

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).

A
Anton, 2016-10-19
@karminski

Oh my God! Are you still using BB Codes??? Time to switch to Markdown.
And on the subject, Alexey Skobkin answered you well

T
trevoga_su, 2016-10-19
@trevoga_su

talked about the forum engine, where the BB code is forgotten after posting and then only HTML is stored.
obviously a crazy idea
- the inability to edit posts
- the inability to implement other formatting for posts with BB code

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question