Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Forum Module /

Discuss the Forum Module.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Short Codes (or Extending BBCode) in the Forum Module


Go to End


5 Posts   2495 Views

Avatar
johnmblack

Community Member, 62 Posts

20 October 2011 at 4:44am

We added some custom short codes to the "core" site code to allow various media embedding. We are now installing the Forum Module. The customer's two biggest requirements are:

- BBCode or similar, not full HTML, for security reasons
- Authors must be able to embed the same kinds of media as the core site.

Is this possible out of the box? Do I understand correctly that the BBCode components are totally separate from the SS ShortCode capabilities? If that is the case, is there a way to *add* a custom BBCode similar to how I added the SS shortcodes? (I don't mind hacking into the bbcode php, if that is possible.)

Thanks!

-John

Avatar
swaiba

Forum Moderator, 1899 Posts

20 October 2011 at 4:55am

Hi John,

I can't comment too much on the forum module, however regarding bbcode. out of the box silverstripe itself supprots basic bbcode. Just replace $Content this in your template with...

$Content.Parse(BBCodeParser)

have a look at "sapphire\parsers\BBCodeParser.php" for the available tags

Avatar
johnmblack

Community Member, 62 Posts

20 October 2011 at 5:56am

Thanks swaiba, I actually need to go in the other direction (get SS shortcodes working inside blog/forum) but you've just pointed me in the right direction for hooking into the bbcode parser.

I think my short term fix is going to be simply adding the 2 or 3 custom codes there to try to function the same way as over on the main site. But I'm also wondering if I could make BBCodeParser.php look at the SS shortcode collection in real time, and include them, such that *any* custom shortcode also works in Blog/Forum. If that works out, maybe you folks would find it useful in the core? I'll let you know how it goes.

Avatar
wojt

Community Member, 2 Posts

10 January 2013 at 9:56am

Hi johnmblack, have you managed to implement short codes in forums? I'd like to do exactly the same.

Regards,
wojt

Avatar
johnmblack

Community Member, 62 Posts

10 January 2013 at 10:49am

I'm actually not on that project anymore since last year; but I think the rest of the team worked something else out. I'll reach out to the current developers to see if they ever solved this, and if so, how.

-John