CodeIgniter Forums
Bbcode support in helper - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forum-29.html)
+--- Thread: Bbcode support in helper (/thread-76902.html)



Bbcode support in helper - mmrtonmoy - 07-01-2020

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.


RE: Bbcode support in helper - Chroma - 07-08-2020

What exactly are you requesting?


RE: Bbcode support in helper - kilishan - 07-08-2020

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.


RE: Bbcode support in helper - hobbyci - 10-10-2020

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.


RE: Bbcode support in helper - includebeer - 10-10-2020

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();

echo 
$Parsedown->text('Hello _Parsedown_!'); # prints: <p>Hello <em>Parsedown</em>!</p>