vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Adding Buttons for BBCode-Solved (https://vborg.vbsupport.ru/showthread.php?t=205262)

MTGDarkness 02-13-2009 03:31 PM

Adding Buttons for BBCode-Solved
 
So, obviously for the advanced editor, you can add a button image for a simple BBCode. But what about adding buttons for this to the quick reply editor?
And how about BBCodes that you had to manually add รก la template hooks due to the necessity of a PHP function or impracticality of HTML to describe them; I have two such that are quite important to the forum and no idea how to add buttons for them to either the advanced editor or the quick reply.

TigerC10 02-13-2009 10:28 PM

This thread has a nice tutorial for adding bbCode buttons to your advanced editor. To add buttons to the quick reply, use the same tutorial except edit the showthread_quickreply template instead of the editor_toolbar_on template.

Read the article before viewing my alteration mentioned below.

However, instead of adding (just to be clear, do NOT add this) from the tutorial
Code:

[S]case 'BBCODE':[/S]
{
        [S]useoption = true;[/S]
}

for a bbCode that has options, simply use the same code for a bbcode that has no options (with one slight alteration):
Code:

<td><div class="imagebutton" id="{$editorid}_cmd_wrap1_BBCODE"><img src="$stylevar[imgdir_editor]/YOURBUTTONIMAGE" width="21" height="20" alt="$vbphrase[YOURALTPHRASE]" /></div></td>
Changing the 0 (from the code in the tutorial) to a 1 will initiate a prompt to ask for the option value of the bbCode.

This works for bbCode that depends on a hook, too. All you need to do is chage the red BBCODE to the actual value of the bbCode... Say your hook defined bbCode is "[video][/video]" - then just put the word video in place of BBCODE in the sample code above.

As for more dynamic things (like a color picker drop down menu), I'm still not sure how to go about that. It would probably involve editing the /clientscript/vbulletin_textedit.js file. If you find out how to do it without altering the .js file , let me know - If I find out I'll post how.

MTGDarkness 02-14-2009 07:30 AM

That worked, thanks! :D
How about to the quick reply editor?

TigerC10 02-14-2009 04:47 PM

I already told you how to do that. :)

Quote:

Originally Posted by TigerC10 (Post 1743312)
To add buttons to the quick reply, use the same tutorial except edit the showthread_quickreply template instead of the editor_toolbar_on template.



All times are GMT. The time now is 12:16 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01594 seconds
  • Memory Usage 1,718KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete