Bbcode support in helper |
In codeigniter add a new helper call bbcode. It takes a string and return html tags.
You can do it with php build in function preg_replace() like bbcode. example : line break return a <br> tag. dobule line break return <p> tag with close tag also. link tag Codeigniter return <a href='www.codeigniter.com'>Codeigniter</a> image tag [img]www.codeigniter.com/logo.jpg[/img] return <img src="www.codeigniter.com/logo.jpg"> please add this helper feature soon.
This is not something that will be in core. There are always third party libraries you can install directly, and PHP even has an extension you can compile in if you need it.
I handle BBCodes via JS, not via PHP.
Take a look at http://github.com/patorjk/Extendible-BBCode-Parser It is easy to setup, easy to extend and easy to use.
Try Parsedown: https://github.com/erusev/parsedown
It's not for BBCodes, it's for Markdown, but the syntax is even easier. The code is super easy to use: PHP Code: $Parsedown = new Parsedown(); |
Welcome Guest, Not a member yet? Register Sign In |