CodeIgniter Forums
HTML tag to BBcode tag - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: HTML tag to BBcode tag (/showthread.php?tid=43574)



HTML tag to BBcode tag - El Forum - 07-16-2011

[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_BBCode_Helper/revision/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.


HTML tag to BBcode tag - El Forum - 07-17-2011

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