Color & BgColor Clickable BBCode Bar

Started by burtybob, June 03, 2008, 04:14:15 AM

Previous topic - Next topic

chinaren

I tried all this, but unfortunately got the error:
QuoteParse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /.../Themes/default/index.template.php on line 51


:(


Quote from: MarkRH on November 11, 2011, 02:18:16 PM

No, I never got the mod working.  I ended up doing my own thing with a jscolor script: http://jscolor.com/ .  I loaded the script at the top of /(theme)/index.template.php:


   // Here comes the JavaScript bits!
   echo '
   <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/script.js?fin20"></script>
   <script type="text/javascript" src="', $settings['theme_url'], '/scripts/theme.js?fin20"></script>
   <script type="text/javascript" src="', $settings['theme_url'], '/scripts/jscolor/jscolor.js"></script>


Then, in /(theme)/Post.template.php around line 398:

   // What about smileys?
   if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup']))
      echo '
               <div id="smileyBox_message"></div>';
   // MarkRH
   echo '<hr class="clear">'."\n";
   echo '<dl id="post_header">'."\n";
   echo '<dt class="clear_left">Color pickers:</dt>
   <dd><input value="[COLOR]" style="cursor: pointer;" size="10" class="color {valueElement:\'myColor\',hash:true}"> <input size="10" style="cursor: pointer;" id="myColor" onclick="surroundText(\'[color=\' + this.value + \']\', \'[/color]\', document.forms.postmodify.message); this.selectedIndex = 0; document.forms.postmodify.message.focus(document.forms.postmodify.message.caretPos);" style="margin-bottom: 0;"> &lt;- Click to insert';
   echo ' | <input value="[BGCOLOR]" style="cursor: pointer;" size="10" class="color {valueElement:\'myBackgroundColor\',hash:true}"> <input size="10" style="cursor: pointer;"  id="myBackgroundColor" onclick="surroundText(\'[bgcolor=\' + this.value + \']\', \'[/bgcolor]\', document.forms.postmodify.message); this.selectedIndex = 0; document.forms.postmodify.message.focus(document.forms.postmodify.message.caretPos);" style="margin-bottom: 0;"> &lt;- Click to insert</dd>';
   echo '</dl>'."\n";
   // end MarkRH

   echo '
               ', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message');


Then, in /Sources/Subs.php around line 1184, I added the bgcolor tag to the list of BBC Codes:

         array(
            'tag' => 'bgcolor',
            'type' => 'unparsed_equals',
            'test' => '(#[\da-fA-F]{3}|#[\da-fA-F]{6}|[A-Za-z]{1,20}|rgb\(\d{1,3}, ?\d{1,3}, ?\d{1,3}\))\]',
            'before' => '<span style="background-color: $1;" class="bbc_color">',
            'after' => '</span>',
         ),


I think that's all I did. This was like 5 months ago so I might have forgotten something LOL.

Hope it helps,
Mark H.
The Opus Path - The Next Generation of the Written Word

bestfriendavinash


bestfriendavinash

I tried for mod Emulate, but didn't worked on SMF 2.0.2  :(

any help??

Advertisement: