MyBB Community Forums

Full Version: Parse message?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How can I show some code in the middle of the message? Not at the end nor at the beginning but in the middle?
Is there a specific pattern you are searching the post for? Knowing what kind of condition you are trying to achieve will make it easier for us to help you.
Considering you're talking about $post['message']:
$l = my_strlen($post['message']);
$half = $l / 2;
$part1 = my_substr($post['message'], 0, $half);
$part2 = my_substr($post['message'], half);
$post['message'] = $part1.' I am in the middle '.$part2;

Of course this may break MyCodes and stuff, so you'll have to add additional checks for that.
Thanks @dragonexpert,

@Destroy666 outstanding buddy! Big thanks! Oh yeah and +1