MyBB Community Forums

Full Version: Coding Issues
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm testing some custom codes that I created (from another bb that I own). I'm having issue with 2 codes not working.

Codes:
{option}
{param}

...not working for me. I'm trying to add them for User replacement. Is there something different in MyBB?

Feeling stupid...Undecided (I apologize if posting in the wrong place)
What code are you actually using...?? We'll need a lot more information on this, we have no idea what you're actually trying to achieve here and what code you're already using. What are you expecting {option} and {param} to do, exactly, and where are you expecting it to do it...??
{Param} is from vB >.> The MyBB system is completely different.
Thanks euantor. That feedback helps. I was playing around with it a good hour to no avail, only to drive myself nuts. I've been reading up on this a great deal since & think I just have to give up for now. I was trying to reuse some old coding of mine from another forum of mine. It's a shame I cannot use it here yet. No biggie though.

>> Here's the code I made (I'm "GamEscape") <<

The problem with not being able to use parm & option means that the spoiler cannot use a custom title (i.e. user option for button title). So if a smart person can hack that part for me give a shout here. I'm gonna keep trying to read up for a replacement. Wink Until then I'll just use a simple spoiler.
MyBB uses $1 and $2 and so on as replacements rather than preset variables. You simply use the number corresponding to the placement of the replacement "variable";

\[url=(.*?)\](.*?)\[/url\]

So there, the first (.*?) would be evaluated as $1 and the second one (between the url tags) would be evaluated as $2. So for the URL MyCode, the replacement is:

<a href="$1">$2</a>

Though of course the stock URL MyCode is a little more complicated in that it also determines whether the person has entered the 2nd variable or not and such. Additionally, I can't remember exactly what the replacement method used is (str_replace?), but it's advisable to not use (.*?) all the time since it can accept any variable - you should use a number-specific replacement for number inputs, for example. This post may help (myself included Toungue):

http://community.mybb.com/thread-12008-p...l#pid78672
(2011-02-06, 04:10 AM)Scoutie44 Wrote: [ -> ]MyBB uses $1 and $2 and so on as replacements rather than preset variables. You simply use the number corresponding to the placement of the replacement "variable";

\[url=(.*?)\](.*?)\[/url\]

So there, the first (.*?) would be evaluated as $1 and the second one (between the url tags) would be evaluated as $2. So for the URL MyCode, the replacement is:

<a href="$1">$2</a>

Though of course the stock URL MyCode is a little more complicated in that it also determines whether the person has entered the 2nd variable or not and such. Additionally, I can't remember exactly what the replacement method used is (str_replace?), but it's advisable to not use (.*?) all the time since it can accept any variable - you should use a number-specific replacement for number inputs, for example. This post may help (myself included Toungue):

http://community.mybb.com/thread-12008-p...l#pid78672

For (.*?)... it only repeated the exact code each time (i.e. no replacement). For $1 and $2... I read a little about that here in these forums yesterday & tried to tweak it in but it's not cooperating. I found great info about this stuff in THIS SECTION. It has really great codes.

I tried testing replacements codes, but it only left me feeling even more... [Image: crazy.gif] lol I'm determined to figure it out, but perhaps you can get it before I do so I don't wind up in the looney bin. Toungue It would be awesome to have it work for Mybb. Big Grin Thanks for the feedback!