MyBB Community Forums

Full Version: MyBB Code query
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm new to MyBB and I'm finding it very hard to get my head around the MyBB mycode system.
I've read the tutorials but find them confusing.

I'm trying to do something really simple, I want to allow the user to place a URL in a post that is automatically replaced by a link image such as this [Image: Wv5fOTI.gif]

I expect it to work like the code below did in phpBB but I'm obviously missing something.

BBCode:
[Link]{URL}[/Link]

Replacement Code:
<a href="{URL}" title="{URL}" onclick="window.open(this.href);return false;"><img src="http://www.dublinboards.org/images/smilies/icon_link.gif"></a>

Any pointers would be much appreciated.
Regular expression:
\[[Ll]ink\](https?:\/\/(?:www\.|(?!www))[a-zA-Z?:.\/]+\.[a-zA-Z&\/\-\.]{2,})\[/[Ll]ink\]
Replacement:
<a href="$1" title="$1" onclick="window.open(this.href);return false;"><img src="http://www.dublinboards.org/images/smilies/icon_link.gif"></a>

And when you do the BBCode ("Link") the L can be lowercase
(10-08-2016, 05:22 PM)nth Wrote: [ -> ]Regular expression:
\[[Ll]ink\](https?:\/\/(?:www\.|(?!www))[a-zA-Z?:.\/]+\.[a-zA-Z&\/\-\.]{2,})\[/[Ll]ink\]
Replacement:
<a href="$1" title="$1" onclick="window.open(this.href);return false;"><img src="http://www.dublinboards.org/images/smilies/icon_link.gif"></a>

And when you do the BBCode ("Link") the L can be lowercase
Thanks very much. I would not have figured that out in a million years.