Hello,
I’m struggling to find a way to add custom BBCode/pMcode that users can use on the Discussion Boards. I need to add these:
[center] [/center] [spoiler] [/spoiler]
[center] would center images or text by adding a class to the element since <center> is no longer in use. And [spoiler] would add a background colour to the container so the user needs to highlight the text in order to read the spoiler.
Is it really that difficult to create an extension that can do this? I know there’s an extension (Videoplug) that adds custom buttons on the forum to add YouTube videos and such, but I’m so useless with programming that I couldn’t modify the plugin to also add the bbcodes above. I’ve also tried digging through core.typography.php to see if I could do something there… but nothing. T_T
I’ll be more than happy to donate something in exchange for an extension that can do this. If not, any help regarding the topic wil be appreciated.
Thanks.
OKs, so I managed to hack core.typography.php to add the changes that I needed and it works perfectly. I added this on line #947:
/** -------------------------------------
/** Center tag
/** -------------------------------------*/
$str = preg_replace("/\[center\](.*?)\[\/center\]/si", "<span>\\1</span>", $str);
/** -------------------------------------
/** Spoiler tag
/** -------------------------------------*/
$str = preg_replace("/\[spoiler\](.*?)\[\/spoiler\]/si", "<div margin-top:5px\"><div class=\"smallfont\" ><b>Spoiler</b>: <input type=\"button\" value=\"Mostrar\" ><div class=\"alt2\" 0px; padding: 6px; border: 1px inset;\"><div none;\">\\1</div></div></div>", $str);Now my only concern is that this is indeed a hack and not a really good way to solving things. I would love to have an extension or something that could add custom BBCode to EE, so if there’s anybody out there willing to help that would be great.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.