SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist
    Join Date
    Jan 2002
    Location
    Scotland, UK
    Posts
    530
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Using phpBB data in my script, how do I remove [quote:a938...] ?

    Hi folks,

    Been working on my website again and everything was going great. It pulls the latest forum post from the phpBB database and displays it on the screen. Then I was checking something else and noticed it had gone weird on me.

    "[quote:17571063fb="Rikki"][quote:17571063fb="w33kr..."

    I hadnt accounted for the fact that although I'd used some BBCode script I found on the net to strip Bold tags and such like, I hadnt got anything that could combat the above.

    I had a look around and found a few things, all of which failed and since Im not very good with regex stuff Im a bit stumped.

    Here are some of the ones I tried :

    Code:
    $post_text = preg_replace("/\[quote:(.*?)\"\]/si", '####', $post_text);
    $post_text = preg_replace("/\[quote\:(.*?)\]/si", '####', $post_text);
    $post_text = preg_replace("/\[quote:([^<]+?)\](.+?)\[\/url\]{1}/is", "<a href='\\1'>\\2</a>", $text);
    $post_text = preg_replace("/\[quote(.*?)\]/si", '####', $post_text);
    I basically want to just strip the tags themselves, the way the data is left doesnt matter too much as only the first 60 chars are going to be displayed but if the data looked like this before:

    [quote:17571063fb="Rikki"][quote:17571063fb="w33kr"]Hello world[/quote:17571063fb] Hello world too )[/quote:17571063fb]

    I'd like it to look like this now:

    Hello world - Hello world too

    Is this an easy thing to do or am I dreaming again

    Many thanks,

    Rikki

  2. #2
    Forums Designer
    Join Date
    Jun 2004
    Posts
    422
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check bbcode_uid field in phpbb_posts_text

  3. #3
    SitePoint Evangelist
    Join Date
    Jan 2002
    Location
    Scotland, UK
    Posts
    530
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, but which regex would I use then? Is there not an easy way of just saying:

    if "[quote**********]" is found remove it all

    ?

    Many thanks,

    Rikki

  4. #4
    Forums Designer
    Join Date
    Jun 2004
    Posts
    422
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    str_replace(':' . $row['bbcode_uid'], '', $row['post_text'])


Bookmarks

Posting Permissions

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