Page 1 of 1
quick question -- bb-code
Posted: Sun Sep 18, 2005 9:01 pm
by darkzerox
i've made a script that allows the user to easily edit any webpage via bb-code.
when the user edits a page, it saves the script as it is (in bb-code).
and only on page-load is it converted to html.
my question is, would it better to convert it to html when saving?
in this case, when the user wants to edit the page again, i would have to convert it back to bb-code, from html.
or should i save two copies of it? one in html (for viewing) and one in bb-code (for editting)
it's currently saved as a text file....
i could try using mysql, i dont know if that would speed things up tho, and im not too familiar with it.
what do you guys suggest?
Posted: Sun Sep 18, 2005 9:09 pm
by RobertPaul
I would say convert it to HTML when saving the editing rather than serving the page. This will likely speed things up, because you won't have to convert it every time the page is served up.
Posted: Sun Sep 18, 2005 9:16 pm
by darkzerox
yeah, i thought so, but it's so small, it hardly takes anytime.
anyways, i think i'll do that.. or maybe on the next site i make.. haha.
thanks for your speedy & helpful reply

Posted: Sun Sep 18, 2005 9:19 pm
by John Cartwright
I don't think there is a point converting it to html when storing it, although it may speed things up a little.. this especially depends on how you actually convert to html. For example, if your using eregi over preg_replace then that would slow it down a lot more. Databases are generally much easier to maintain and optimize rather than flatfiles, especially when dealing with lots of data.
Posted: Sun Sep 18, 2005 10:37 pm
by feyd
I prefer to store the original, store the converted and store a timestamp of the last update to the record. If any changes are made to how bbcode operates, you may want to rerun all "files" older than the bbcode change time. Assuming you want to store all the data in the database, it'll easily keep the best of both worlds, ultra fast display, and easily editable.
Posted: Mon Sep 19, 2005 5:33 am
by timvw
As usual, the choice between memory and cpu usage
1-) Only store the text with bbcode. And generate the html each time the text is requested.
2-) Store a text and a html version. The text version is used for editting and the html version is used for output.
Posted: Mon Sep 19, 2005 8:03 pm
by Ambush Commander
memory
You know, my dad has this thing against using "memory" when you're referring to disk space: he claims that it means RAM, so you shouldn't use memory.
Ah well.
Posted: Tue Sep 20, 2005 3:37 am
by Jenk
Memory is RAM.. Random Access Memory.
Posted: Tue Sep 20, 2005 5:42 am
by timvw
Actually, i wasn't referring to a specific storage medium (be it ram, harddisk, ...) I really meant
Memory.