PDA

View Full Version : Cannot parse if function in Custom BBCode's Replacement


AnhTuanCool
01-06-2005, 03:15 AM
Hi all,

Ok, here's the problem, I wanna make some conditions within the new bbcode I made so I added <if condition...blah blah in the Replacement box in the Add New BB Code and submitted it. But when I turned out and checked it, only the other html elements worked, but if. Ie. I put <if condition="2 < 1">Yeah, 1 is greater than 2<else />Nop 2 is still greater</if> in the Replacement and the text came out as "Yeah, 1 is greater than 2 Nop 2 is still greater" :speechless:. Any replies would be appreciated. Thanks

Xenon
01-06-2005, 12:04 PM
the if conditions are handled in the template parser, which is run while saving a new template.

if you want to be able to run conditions in bbcode as well, you have to modify the parse_bbcode2 function

AnhTuanCool
01-06-2005, 08:54 PM
I tried to disable and remove the REMOVE HTML CODES section in parse_bbcode2 functions but the weird thing still came up, can you be more specific about what to modify, that would be great Xenon, thanks.

Xenon
01-07-2005, 12:04 PM
not really

i mean it's not a one liner, you would have to add an if condition parser into the bbcode parsing function...

AnhTuanCool
01-07-2005, 09:45 PM
Hmmm, I thought if condition is a html function and it gotta be trimmed somewhere because all the other html functions work but if? :/ So actually what do I need to modify/add? Can you help me out Xenon?

Xenon
01-08-2005, 12:03 PM
nope, the if function is written by the developers into the template parser.

it just looks like a normal html code, but it isn't ;)

i'd say to take a look at logicians conditional hacks, to see the general way of how such things are coded

AnhTuanCool
01-13-2005, 10:36 PM
Hmmm, I've looked at the dynamic annoucement by him and I'd say he just tried to find the if conditional in the text message and then parse it through parse_bbcode2, the point is $dohtml is to 1 in his function, then is that the one I'm looking for? As normal, text message's bbcode is parse through parse_bbcode and then it transfers itself to parse_bbcode2, but I have no idea where $dohtml is defined? Is it a constant or something?

Link14716
01-14-2005, 01:26 AM
Better yet, look at any code dealing with the quote function and copy if for the new tag. Then just make a template.

AnhTuanCool
01-14-2005, 07:58 PM
@Link14716 - I did, make it all the way like the QUOTE bbcode with function and tag...but when I put it up in the forum, try to open a post with the tag and nothing parse, the tag was just as I typed in. :\