MyBB Community Forums

Full Version: Nested MyCode tags
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I wasn't 100% on where to put this, so if it's in the wrong place I'm sorry.

I want to create a custom MyCode that uses nested tags, something like this:

[outer]
[inner]Inner tags should[/inner]
[inner]only work if they[/inner]
[inner]are inside the[/inner]
[inner]outer tags.[/inner]
[/outer]

However, I can't figure out how to deal with it. I need the inner tags to only work if they're in the outer tags or the user might be able to start messing up the layout of the page, or at least their post. It actually needs multiple levels of nested tags but I think I'm smart enough to figure out multiple levels from a single-nesting example.

Thank you for your time![/code]
I don't think it's possible with MyCode. Nested tags such as list *, are treated specially by inc/class_parser.php. You may have to write PHP code for this. That or just make MyCodes and moderate anyone who uses them badly.
I almost had it working, but I just don't get regexes. What I had was each inner tag checked for either the opening outer tag or the closing of the previous inner tag. It almost worked, but it didn't quite handle the security issue case properly.