11
« on: March 17, 2009, 05:33:56 am »
on a forum I manage I added a spoiler tag that acts like a blockout. it's like a black highliter with black text ( actually dark green in this case ) and you have to select the text to see it. spoiler tags are simply [spoiler]Snape did it[/spoiler]
here's the php for it, though it won't necessarily work on this forum, it's for phpbb2 and these are for the bbcode.php and bbcode.tpl files
// [spoiler] and [/spoiler] for marking possible spoilers
$text = str_replace("[spoiler:$uid]", $bbcode_tpl['spoiler_open'], $text);
$text = str_replace("[/spoiler:$uid]", $bbcode_tpl['spoiler_close'], $text);
// [spoiler] and [/spoiler] for marking possible spoilers
$text = preg_replace("#\[spoiler\](.*?)\[/spoiler\]#si", "[spoiler:$uid]\\1[/spoiler:$uid]", $text);
<!-- BEGIN spoiler_open --><span style="color:#009900; background-color:#009900"><!-- END spoiler_open -->