Jump to content

[SOLVED] Remove line break after every list item


The Little Guy

Recommended Posts

I have this function, which converts BB Code to HTML (It works perfect for me)

 

    function bbc($text){
        $find = array(
            '~\[img=(.*?)\]~s',
            '~\[url=(.*?)\](.*?)\[/url\]~s',
            '~\[ol\](.*?)\[/ol\]~s',
            '~\[ul\](.*?)\[/ul\]~s',
            '~\[li\](.*?)\[/li\]~s'
        );
        $replace = array(
            '<img src="$1" />',
            '<a href="$1">$2</a>',
            '<ol>$1</ol>',
            '<ul>$1</ul>',
            '<li>$1</li>'
        );
        return preg_replace($find,$replace,$text);
    }

 

next, this is the part I am having an issue with this:

 

echo '.bbc(nl2br($row['info']));

 

 

It converts the text how I want, the problem is with how it is displayed. after ever </li> tag, there is a <br> tag. I want to remove the <br> tag after ever </li> tag.  How can I do it?

 

Example data:

 

We don't keep statistics of sites that are not registered. If you would like your site to get statistics about it, then please feel free to register or log into your accout, and you can add your site.

[ol]
[*][url=/login]Login
[*]Create a new project
[*]Follow the steps on the page
[*]Copy our code to your website
[/ol]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.