I have a preg_replace code used for bbcode on my site.

When you create a list in the bbcode like so:

[list*]
[li]lalala[/li]
[li]lalala[/li]
[/list*]

(Minus the *'s)

It outputs it like so in html:

<ul>
<li>lalala</li><br/>
<li>lalala</li><br/>
</ul>

Any way to get around this?

It uses nl2br() to make line breaks from the bbcode to html display. Thanks!

    well they are added by nl2br() so how about you stop using nl2br() ?

      dagon;10911029 wrote:

      well they are added by nl2br() so how about you stop using nl2br() ?

      Then how do I make the line breaks into "<br/>"?

        bgallz;10911039 wrote:

        Then how do I make the line breaks into "<br/>"?

        nl2br()

          nl2br() is the function you want, you just have to apply it differently.

          For example, you might have to use [man]preg_replace_callback/man to use nl2br() only on text that isn't within [noparse]

          • ..

          [/noparse] tags (or other tags where you wouldn't want line breaks to be converted into <br> elements).

            Write a Reply...