CodeIgniter Forums

Full Version: HTML tag to BBcode tag
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Mowgli[/eluser]
Hello,

I am creating a simple blog and i decided to add some BBcode.
I used this helper which worked fine:
http://codeigniter.com/wiki/Another_BBCo...sion/3961/

But what if i want to edit the topic/message ? Is there any (already written) function i could use to convert the HTML tags into BBcode tags ? BBcode to HTML worked just fine.

Thanks in advance.

LE: i found a solution. I simply convert the BBcode to HTML code only when i echo out (instead of storing the converted version into the database). I should've thought of it earlier. Thanks anyway.

El Forum

[eluser]Aken[/eluser]
Nice job thinking of that! Yeah, you should definitely store the non-HTML form of the post in the database in case it needs to be updated. You can save the HTML version as well to your database if you'd like - might save your application a bit of headache and speed if you have a lot of traffic.