2010-09-09, 11:33 PM
I have a relatively simple mycode I want to add to my forum but I cannot figure out the best facility to do that in mybb
Basically, it's a forum based on an online game and there is a service that when you make a link to something, a javascript include in the header file generates a mouseover that shows you item information. If you've ever played World of Warcraft, it's like what happens when you mouseover an item in your bag.
Now by default you can do [url] tags to do this, but it's kind of cumbersome. For example, here is a "Marmot Steak" recipe link:
<a href="http://ffxiv.yg.com/recipe/marmot-steak">Marmot Steak</a>
And with some cumbersome bbcode, it works:
[url=http://ffxiv.yg.com/recipe/marmot-steak]Marmot Steak[/url]
Now what I want to do is make a tag, [recipe], that accomplishes the same thing. In other words, typing [recipe]Marmot Steak[/recipe], the above link would be generated. We can get 90% of the way there easily:
New mycode regular expression: \[recipe\](.*?)\[/recipe\]
Replacement: <a href="http://ffxiv.yg.com/recipe/$1">$1</a>
The only issue, of course, is that the generated link is http://ffxiv.yg.com/recipe/Marmot Steak, when it should be http://ffxiv.yg.com/recipe/marmot-steak
Try as I might, I cannot figure out a way to actually transform the input, for example:
<a href="http://ffxiv.yg.com/recipe/<?php echo urlencode($1)?>">$1</a>
doesn't get me anywhere!
Is there any way to do this transformation within the mycode editor? If not, where would be the ideal place for a plugin hook?
Thank you
Basically, it's a forum based on an online game and there is a service that when you make a link to something, a javascript include in the header file generates a mouseover that shows you item information. If you've ever played World of Warcraft, it's like what happens when you mouseover an item in your bag.
Now by default you can do [url] tags to do this, but it's kind of cumbersome. For example, here is a "Marmot Steak" recipe link:
<a href="http://ffxiv.yg.com/recipe/marmot-steak">Marmot Steak</a>
And with some cumbersome bbcode, it works:
[url=http://ffxiv.yg.com/recipe/marmot-steak]Marmot Steak[/url]
Now what I want to do is make a tag, [recipe], that accomplishes the same thing. In other words, typing [recipe]Marmot Steak[/recipe], the above link would be generated. We can get 90% of the way there easily:
New mycode regular expression: \[recipe\](.*?)\[/recipe\]
Replacement: <a href="http://ffxiv.yg.com/recipe/$1">$1</a>
The only issue, of course, is that the generated link is http://ffxiv.yg.com/recipe/Marmot Steak, when it should be http://ffxiv.yg.com/recipe/marmot-steak
Try as I might, I cannot figure out a way to actually transform the input, for example:
<a href="http://ffxiv.yg.com/recipe/<?php echo urlencode($1)?>">$1</a>
doesn't get me anywhere!
Is there any way to do this transformation within the mycode editor? If not, where would be the ideal place for a plugin hook?
Thank you