Results 1 to 2 of 2

Thread: [Resolved] Creating a [list] tag?

Threaded View

  1. #1

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    [Resolved] Creating a [list] tag?

    I'm creating some sort of bbcode for one of the projects I'm working on, and am running into a bit of trouble with a [list] tag.

    The list tag was supposed to look like this:

    [list=#]
    [*]ListItem
    [/list]

    Where # is the type of list.


    This is what I started with:

    Code:
    $tags = array("/\[list=1\](.*)\[\/list\]/siU", "/\[list=2\](.*)\[\/list\]/siU", 
            "/\[list=3\](.*)\[\/list\]/siU", "/\[\*\](.*)/siU");
    
    $html = array("<ol>\\1</ol>", "<ol type=\"a\">\\1</ol>", 
            "<ul>\\1</ul>", "<li>\\1");
    
    $msg = preg_replace($tags, $html, $msg);
    Now, since I also run nl2br() on the $msg, it replaces newlines with <br /> tags. So my list ends up looking like this:

    Code:
    <ol><br />
    <li>Testing<br />
    <li>The<br />
    <li>Numbered<br />
    <li>List</ol><br />
    The <br />'s in there create a lot of problems with spacing and margins.

    So my question is: how can I remove the newlines with my expression?
    Last edited by The Hobo; Jun 5th, 2003 at 01:00 PM.
    My evil laugh has a squeak in it.

    kristopherwilson.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width