quick question -- bb-code
Moderator: General Moderators
quick question -- bb-code
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?
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?
-
RobertPaul
- Forum Contributor
- Posts: 122
- Joined: Sun Sep 18, 2005 8:54 pm
- Location: OCNY
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
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.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
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.
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US