https://www.icyphoenix.com/viewtopic.php?f=28&t=4785 ----------------------------------- glenflet Sat 27 Sep, 2008 06:55 Adding New BBcode Tags ----------------------------------- Ok now that I've got my code 2 html BBcode working, I would like to try adding some whole new BBcode tags, to use a few Java functions for some cool text effects. Could some one explain what I need to do to define new BBcode tags. ----------------------------------- Lopalong Sun 28 Sep, 2008 02:13 Re: Adding New BBcode Tags ----------------------------------- You should be able to find that in the docs section - And it's a whole lot different from the usual way of doing it. ;) ----------------------------------- glenflet Sun 28 Sep, 2008 06:34 Re: Adding New BBcode Tags ----------------------------------- [quote user="Lopalong" post="32373"]You should be able to find that in the docs section - And it's a whole lot different from the usual way of doing it. ;)[/quote] I had a look there, but could find any thing about how to add the new tags. Can you provide a direct link to the topic please. Edit: I would also like to replace phpBB3 BBcode, with Icy Phoenix BBcode, as phpBB 3 is to hard to modify to my own needs, any suggestions on how I should go about this? ----------------------------------- Lopalong Sun 28 Sep, 2008 08:09 Re: Adding New BBcode Tags ----------------------------------- You're right mate, difficult to locate for the uninitiated. ;) There's a lot of work being done on docs now - but that's not going to help short-term. :( Though this should help. http://www.icyphoenix.com/viewtopic.php?f=4&t=4403&p=29850#p29850 ----------------------------------- glenflet Sun 28 Sep, 2008 08:28 Re: Adding New BBcode Tags ----------------------------------- I had a look at that topic, but I don't see how that tells, me how to add ne BBcode tags. I've got some javascript I want to use with BBcode. i.e.[code linenumbers=false][/code] Where the BBcode would be [code linenumbers=false][rainbow speed=80]Hello World![/rainbow][/code] i.e.[code linenumbers=false][/code] Where the BBcode would be [code linenumbers=false][neon speed=80 basecolor=128,128,128 textcolor=0,255,255]Hello World![/neon][/code] I also want to rename the existing rainbow to gradient. I can make the php to generate the HTML output just fine, it just how to add the tags to the BBcode that I can't do, and how to tell it what variable I'm look for, to cofirm I understant that propely. ----------------------------------- Lopalong Sun 28 Sep, 2008 08:56 Re: Adding New BBcode Tags ----------------------------------- :mrviolet: This is an unreleased MOD that I've done for the next version of IP (Though it's basically the same) and it should contain all of the examples you need - Plus put you in the right places to compare other bbCode entries that switch other params as well. ;) And this example adds a url option - You only want simple tags. :) [spoiler][code linenumbers=false]############################################################## ## MOD Title: High Slider ## MOD Author: Lopalong http://www.icythemes.com ## MOD Description: Adds the bbCode for Highslider ## ## MOD Version: 1.0.0 ## ## Installation Level: (Easy) ## Installation Time: ~5 Minutes ## Files To Edit: includesbbcb_mg.php ## includesbbcb_mg_small.php ## includesbbcode.php ## includesalbum_modalbum_bbcode.php ## languagelang_englishbbcb_mg.js ## languagelang_englishlang_bbcb_mg.php ## templatesmg_themesoverall_include.tpl ## templatesmg_themesbbcb_mg.tpl ## ############################################################## ## ## Example: [slider]Image URL[/slider] ## ############################################################## ## ## Version log ## ## 1.0.0 --> First release 12th September 2008 ## ## ############################################################## ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD ############################################################## # #-----[ COPY ]------------------------------------------ # highslide folder to /your_forum_Root/highslide #-----[ COPY ]------------------------------------------ # slider*.gif to images/bbcb_mg/images/gif/ # #-----[ OPEN ]--------------------------------- # includes/bbcb_mg.php # #-----[ FIND ]--------------------------------- # 'L_BBCB_MG_YOUTUBE' => $lang['bbcb_mg_youtube'], # #-----[ AFTER ADD ]--------------------------------- # // BEGIN HighSlider 'L_BBCB_MG_SLIDER' => $lang['bbcb_mg_slider'], // END HighSlider # #-----[ FIND ]--------------------------------- # 'L_YOUTUBE_HELP' => $lang['s_youtube_help'], # #-----[ AFTER ADD ]--------------------------------- # // BEGIN HighSlider 'L_SLIDER_HELP' => $lang['s_slider_help'], // END HighSlider # #-----[ OPEN ]--------------------------------- # includes/bbcb_mg_small.php # #-----[ FIND ]--------------------------------- # 'L_BBCB_MG_YOUTUBE' => $lang['bbcb_mg_youtube'], # #-----[ AFTER ADD ]--------------------------------- # // BEGIN HighSlider 'L_BBCB_MG_SLIDER' => $lang['bbcb_mg_slider'], // END HighSlider # #-----[ FIND ]--------------------------------- # 'L_YOUTUBE_HELP' => $lang['s_youtube_help'], # #-----[ AFTER ADD ]--------------------------------- # // BEGIN HighSlider 'L_SLIDER_HELP' => $lang['s_slider_help'], // END HighSlider # #-----[ OPEN ]--------------------------------- # includes/bbcode.php # #-----[ FIND ]--------------------------------- # 'youtube' => array( 'nested' => true, 'inurl' => true, 'allow_empty' => false, ), # #-----[ AFTER ADD ]--------------------------------- # // BEGIN HighSlider 'slider' => array( 'nested' => true, 'inurl' => true, 'allow_empty' => false, ), // END HighSlider # #-----[ FIND ]--------------------------------- # if( ($tag === 'flash') || ($tag === 'swf') || ($tag === 'video') || ($tag === 'ram') || ($tag === 'quick') || ($tag === 'stream') || ($tag === 'emff') || ($tag === 'mp3') || ($tag === 'youtube') || ($tag === 'googlevideo') ) # #-----[ IN LINE FIND ]--------------------------------- # | ($tag === 'youtube') | # #-----[ IN LINE,AFTER ADD ]--------------------------------- # | ($tag === 'slider') | # #-----[ FIND ]--------------------------------- # elseif ($tag === 'youtube') { $html = '
Link
'; } # #-----[ AFTER ADD ]--------------------------------- # // BEGIN HighSlider elseif ($tag === 'slider') { $html = '
Highslide JS
HighSlide modification by icythemes.com
'; } // END HighSlider # #-----[ OPEN ]--------------------------------- # includesalbum_modalbum_bbcode.php # #-----[ FIND ]--------------------------------- # 'youtube' => array( 'nested' => true, 'inurl' => true, 'allow_empty' => false, ), # #-----[ AFTER ADD ]--------------------------------- # // BEGIN HighSlider 'slider' => array( 'nested' => true, 'inurl' => true, 'allow_empty' => false, ), // END HighSlider # #-----[ FIND ]--------------------------------- # if($tag === 'flash' || $tag === 'swf' || $tag === 'video' || $tag === 'ram' || $tag === 'quick' || $tag === 'stream' || $tag === 'emff' || $tag === 'youtube' || $tag === 'googlevideo') # #-----[ IN LINE FIND ]--------------------------------- # | $tag === 'youtube' | # #-----[ IN LINE,AFTER ADD ]--------------------------------- # | $tag === 'slider'| # #-----[ FIND ]--------------------------------- # elseif ($tag === 'youtube') { $html = '
Link
'; } # #-----[ AFTER ADD ]--------------------------------- # // BEGIN HighSlider elseif ($tag === 'slider') { $html = '
Highslide JS
HighSlide modification by icythemes.com
'; } // END HighSlider # #-----[ OPEN ]--------------------------------- # languagelang_englishbbcb_mg.js # #-----[ FIND ]--------------------------------- # s_youtube_help = 'Insert YouTube video file: [youtube]YouTube ID[/youtube]'; # #-----[ AFTER ADD ]--------------------------------- # // BEGIN HighSlider s_slider_help = 'Insert image: [slider]http://image_url[/slider]'; // END HighSlider # #-----[ FIND ]--------------------------------- # var youtube = 0; # #-----[ AFTER ADD ]--------------------------------- # // BEGIN HighSlider var slider = 0; // END HighSlider # #-----[ FIND ]--------------------------------- # '[youtube]','[/youtube]', # #-----[ AFTER ADD ]--------------------------------- # // BEGIN HighSlider '[slider]','[/slider]', // END HighSlider # #-----[ FIND ]--------------------------------- # function BBCyoutube() { var FoundErrors = ''; var enterURL = prompt(s_youtube_insert, s_id_insert_tip); if (!enterURL) { FoundErrors += s_id_insert_error; } if (FoundErrors) { alert(s_gen_error + FoundErrors); return; } var ToAdd = "[youtube]"+enterURL+"[/youtube]"; PostWrite(ToAdd); } # #-----[ AFTER ADD ]--------------------------------- # // BEGIN HighSlider function BBCslider() { var FoundErrors = ''; var enterURL = prompt(s_url_insert, s_url_insert_tip); if (!enterURL) { FoundErrors += s_file_insert_error; } if (FoundErrors) { alert(s_gen_error + FoundErrors); return; } var ToAdd = "[slider]"+enterURL+"[/slider]"; PostWrite(ToAdd); } // END HighSlider # #-----[ OPEN ]--------------------------------- # languagelang_englishlang_bbcb_mg.php # #-----[ FIND ]--------------------------------- # $lang['bbcb_mg_youtube'] = 'YouTube'; # #-----[ AFTER ADD ]--------------------------------- # // BEGIN HighSlider $lang['bbcb_mg_slider'] = 'HighSlider'; // END HighSlider # #-----[ FIND ]--------------------------------- # $lang['s_youtube_help'] = 'Insert YouTube file: [youtube]YouTube ID[/youtube]'; # #-----[ AFTER ADD ]--------------------------------- # // BEGIN HighSlider $lang['s_slider_help'] = 'Insert image: [slider]http://image_url[/slider]'; // END HighSlider # #-----[ OPEN ]--------------------------------- # templatesmg_themesoverall_include.tpl # #-----[ FIND ]--------------------------------- # # #-----[ AFTER ADD ]--------------------------------- # # #-----[ OPEN ]--------------------------------- # templatesmg_themesbbcb_mg.tpl # #-----[ FIND ]--------------------------------- #    # #-----[ AFTER ADD ]--------------------------------- # {L_BBCB_MG_SLIDER}   # #-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ [/code][/spoiler] ----------------------------------- Mighty Gorgon Sun 28 Sep, 2008 11:59 Re: Adding New BBcode Tags ----------------------------------- You need to add the tag into this array: [b]var $allowed_bbcode = array[/b] (follow what has been done for others...) Then you need to add the IF statement into the [b]function process_tag(&$item)[/b] adding the HTML you want to output. That should be enough for your BBCode to work. ----------------------------------- glenflet Mon 29 Sep, 2008 04:48 Re: Adding New BBcode Tags ----------------------------------- Ok,I've got the BBcode working now, thanks for the help [b][size=14]How to Add Rainbow and Neon Text[/size][/b] EXTRACT [b]texteffects.zip[/b] to [b]templates/common/js[/b] OPEN [b]includes/bbcode.php[/b] FIND [codeblock] 'rainbow' => array( 'nested' => true, 'inurl' => true, 'allow_empty' => false, ),[/codeblock] REPLACE WITH [codeblock] 'gradient' => array( 'nested' => true, 'inurl' => true, 'allow_empty' => false, ),[/codeblock] ADD AFTER [codeblock] 'neon' => array( 'nested' => false, 'inurl' => false, ), 'rainbow' => array( 'nested' => false, 'inurl' => false, ),[/codeblock] FIND [codeblock] // RAINBOW if($tag === 'rainbow') { /* if($this->is_sig) { return $error; } */ $html = rainbow($content); return array( 'valid' => true, 'html' => $html, 'allow_nested' => false, ); }[/codeblock] REPLACE WITH [codeblock] // GRADIENT if($tag === 'gradient') { /* if($this->is_sig) { return $error; } */ $html = rainbow($content); return array( 'valid' => true, 'html' => $html, 'allow_nested' => false, ); }[/codeblock] ADD AFTER [codeblock] // RAINBOW if($tag === 'rainbow') { /*if($this->is_sig) { return $error; }*/ $speed = 80; if(isset($item['params']['speed'])) { try { $speed = intval($item['params']['speed']); } catch (Exception $e) { break; } } $text = $content; if(strpos($text,"n") !== false) { return $error; } $html = "nnn"; return array( 'valid' => true, 'html' => $html, ); } // NEON if($tag === 'neon') { /*if($this->is_sig) { return $error; }*/ $speed = 80; if(isset($item['params']['speed'])) { try { $speed = intval($item['params']['speed']); } catch (Exception $e) { break; } } $colors = array(); $red = 128; $green = 128; $blue = 128; if(isset($item['params']['basecolor'])) { try { $colors = split(",",$item['params']['basecolor']); for($i=0;$i<3;$i++) { if (intval($colors[$i]) > 255) { $colors[$i] = "255"; } elseif (intval($colors[$i]) < 0) { $colors[$i] = "0"; } } $red = intval($colors[0]); $green = intval($colors[1]); $blue = intval($colors[2]); } catch (Exception $e) { break; } } $basecolor = "rgb(" . $red . ", " . $green . ", " . $blue . ")"; $red = 64; $green = 64; $blue = 255; if(isset($item['params']['textcolor'])) { try { $colors = split(",",$item['params']['textcolor']); for($i=0;$i<3;$i++) { if (intval($colors[$i]) > 255) { $colors[$i] = "255"; } elseif (intval($colors[$i]) < 0) { $colors[$i] = "0"; } } $red = intval($colors[0]); $green = intval($colors[1]); $blue = intval($colors[2]); } catch (Exception $e) { break; } } $textcolor = "rgb(" . $red . ", " . $green . ", " . $blue . ")"; $text = $content; if(strpos($text,"n") !== false) { return $error; } $html = "nnn"; return array( 'valid' => true, 'html' => $html, ); }[/codeblock] OPEN [b]templates/mg_themes/overall_include.tpl[/b] FIND [codeblock]{UPI2DB_FIRST_USE}[/codeblock] ADD BEFORE [codeblock][/codeblock] NOTE: If you have other base template, You'll need to modify them as well. BBcode Info Key {optional=Defualt Value} required=Format Neon Highlight letter by letter at given speed, stays lit for a bit thte restarts. [code linenumbers=false][neon {speed=80} {basecolor=128,128,128} {textcolor=0,0,255}]Text here[/neon][/code] Rainbow Text changes colour at given speed [code linenumbers=false][rainbow {speed=80}]Text here[/neon][/code] NOTE: the old rainbow is now gradient