HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Please upgrade here. These earlier versions are no longer being updated and have security issues.

Adding new tags, and parsing each line within the tags.

This discussion is related to the nbbc addon.
edited November 2011 in Vanilla 2.0 - 2.8
I want two new tags for this plugin. One is [card]word[/card] that will handle individual words, and that much I have working fine.

I then want:

[cards]
One
Two
Three
Four
[/cards]

And that'll essentially do what [card] does, but for each line between the tags. I'm not the savviest programmer, but could probably figure it out with enough time.

Any suggestions? I wish their was an existing method in the plugin to do that. You'd think the [list] would work with one, instead of having to [*] each entry. Anyways, thanks for any possible help!

Best Answer

  • ToddTodd Chief Product Officer Vanilla Staff
    Accepted Answer
    NBBC allows you to make completely custom tags and we fire an event to allow you to customize it. Here's some code to get you started.
    public function NBBCPlugin_AfterNBBCSetup_Handler($Sender, $Args) {
    $BBCode = $Args['BBCode'];
    $BBCode->AddRule('cards', array(...)); // Look at the quote tag in the nbbc plugin for hints.
    }

Answers

  • ToddTodd Chief Product Officer Vanilla Staff
    Accepted Answer
    NBBC allows you to make completely custom tags and we fire an event to allow you to customize it. Here's some code to get you started.
    public function NBBCPlugin_AfterNBBCSetup_Handler($Sender, $Args) {
    $BBCode = $Args['BBCode'];
    $BBCode->AddRule('cards', array(...)); // Look at the quote tag in the nbbc plugin for hints.
    }
  • Oh cool, I didn't know you responded! Very awesome. I will look into it and whatever I do discover, I'll post the results here. I'm thinking this will be useful for every MTG fan. :)
  • ToddTodd Chief Product Officer Vanilla Staff
    Used to play that game all the time. Lost track a while ago, but those guys are some smart game designers.
  • I got it man, awesome. I just copied the QuoteTo function and removed the crap I didn't need, and within it exploded $content on \n and went from there. Very cool.

    Thanks for the tip and man it took me forever to get around to this, heh.

  • sorry for asking the old topics, but i really interest with this project, i have script to show card tool tips from phpbb and want to use it in vanilla forum, any tips on how to do that? thx

  • @mozard said:
    sorry for asking the old topics, but i really interest with this project, i have script to show card tool tips from phpbb and want to use it in vanilla forum, any tips on how to do that? thx

    Look at MathjaxCDN, PremHide, and Spoilers plugins for tips.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • thank you for your reply, will try for it :)

  • Hi, want to ask again, how to apply it on commentary? The code only execute on New Discussion only ..

Sign In or Register to comment.