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]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.