Hello,
PHP Beginner here. Please go easy on me. My problem is as follows:
I want to display latest post from a forum on a webpage. I want to completely strip out [ quote], [ img], [ flash] and [ youtube] tags, including the text between the tags.
I then want to simply remove any other bbcode tags. For example, [ b], [ i], [ list], [ code], etc. Leaving the text between the tags in place.
I have tried searching the forum and web in general, but most bbcode regex questions seem to be to do with converting bbcode to html instead of simply stripping tags and contents - plus, the fact im a beginner and don't really know what im doing makes things a lot harder to understand.
I currently have the following (please excuse me for any awfully written code):
$messagebody = $row['post_text'];
// Remove [quote] [img] [flash] [youtube] code entirely (including contents)
// :-(
// Remove [b] [i] [u] [list] [*], etc (just tags)
// :-(
// Remove any nasty html tags
$messagebody = strip_tags($messagebody);
print '<p>'.$row['username'].' says: <a href="forum/viewtopic.php?t='.$row['post_id'].'">'.$messagebody.'</a></p>';
The commented out frowny faces represent my failure at knowing what to do.
I apologise if this gets asked all the time, I did try searching, honest!
Any help, or links to somewhere I can find an answer, would be much appreciated.
Thanks,
Andy