Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: bobdole2281 - syyskuu 27, 2013, 01:47:26 IP

Otsikko: Turn a php string into bbc code
Kirjoitti: bobdole2281 - syyskuu 27, 2013, 01:47:26 IP
Hello everyone,

I am trying to turn a string from php that I am echoing into bbc code. Meaning, I want it to display as bbc code, here is an example:

echo "[-url=http://google.com]Google link[/url-]"; (No hyphens)

This will display as: [-url=http://google.com]Google link[/url-]

I want it to display as: Google Link (http://google.com)

Is their any command I can wrap around this or use. Thanks!!
Otsikko: Re: Turn a php string into bbc code
Kirjoitti: Arantor - syyskuu 27, 2013, 01:51:21 IP
Well, parse_bbc is the bbc parser, but it expects a properly formatted string being given to it. As usual, not enough details for us to be able to help you (do you already have a properly formatted and known safe string? should smileys be parsed? is this user submitted or preset? do all bbc tags have to be used or only a specific subset?)
Otsikko: Re: Turn a php string into bbc code
Kirjoitti: bobdole2281 - syyskuu 27, 2013, 02:17:02 IP
That worked. Thanks! I forgot what the function looked like.