Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > Programming Articles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Adding New Buttons to the Editor Toolbar
akanevsky
Join Date: Apr 2005
Posts: 3,972

 

Show Printable Version Email this Page Subscription
akanevsky akanevsky is offline 09-30-2005, 10:00 PM

Start by opening the editor_toolbar_on template.
That is the only template you need to edit, since in vBulletin this same template corresponds to both the standard editor and the wysiwig.

Find:
$vBeditTemplate[extrabuttons]

Before that row is where you should add buttons. However, you can add them anywhere you want if you know what you are doing.

Now about the buttons themselves:

Code:
<td><img src="$stylevar[imgdir_editor]/separator.gif" width="6" height="20" alt="" /></td>
Standard vBulletin Button Separator, does not do anything except separating buttons.

Code:
<td><div class="imagebutton" id="{$editorid}_cmd_wrap0_BBCODE"><img src="$stylevar[imgdir_editor]/YOURBUTTONIMAGE" width="21" height="20" alt="$vbphrase[YOURALTPHRASE]" /></div></td>
BBCODE - this part is what defines the bbcode to be insterted. Whatever you put instead of "BBCODE" goes into the square tag brackets.
YOURBUTTONIMAGE and YOURALTPHRASE are respectively the image and the descriptive phrase for that image.
You can also change the width of the image, but everything else should not be touched - esspecially the DIV ID (except the BBCODE part).

So far so good. But this does not allow a user to define a parameter for the bbcode tag.
To fix, open vbulletin_textedit.js located in clientscript folder, and find:

Code:
case 'PHP':
{
	this.apply_format('removeformat');
}
And below add:

Code:
case 'BBCODE':
{
	useoption = true;
}
Where BBCODE, of course, is the same bbcode you added earlier. Must be capitalized.

Done!

If anyone wants to add some information on how to make the buttons perform your own functions, do it.
Reply With Quote
  #32  
Old 06-19-2010, 03:25 AM
ArchAngelz ArchAngelz is offline
 
Join Date: May 2010
Posts: 137
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Any update of this for vb4?
Reply With Quote
  #33  
Old 07-31-2010, 06:13 PM
RobDog888's Avatar
RobDog888 RobDog888 is offline
 
Join Date: Apr 2007
Location: Degabah Swamp
Posts: 293
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Im looking to add my bbcode button to the quick reply and quick edit but nothing found yet.
Reply With Quote
  #34  
Old 04-17-2011, 10:13 PM
jackaninny jackaninny is offline
 
Join Date: Feb 2011
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Love to see this updated for VB4
Reply With Quote
  #35  
Old 07-29-2011, 01:15 AM
VBIran VBIran is offline
 
Join Date: Nov 2010
Location: Iran
Posts: 91
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Update this to vbulletin 4..
Reply With Quote
  #36  
Old 08-25-2011, 09:58 AM
Ludens Ludens is offline
 
Join Date: Jan 2010
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Create a BBCODE and name it "justify"


Templates to edit: editor_toolbar_on

look for:
Code:
 <vb:if condition="$stylevar['textdirection'] == 'ltr'">

there you will have:
Code:
<img src="{vb:stylevar imgdir_editor}/justifyleft.png" class="imagebutton" id="{vb:raw editorid}_cmd_justifyleft" width="20" height="20" alt="{vb:rawphrase align_left}" />

<img src="{vb:stylevar imgdir_editor}/justifycenter.png" class="imagebutton" id="{vb:raw editorid}_cmd_justifycenter" width="20" height="20" alt="{vb:rawphrase align_center}" />

<img src="{vb:stylevar imgdir_editor}/justifyright.png" class="imagebutton" id="{vb:raw editorid}_cmd_justifyright" width="20" height="20" alt="{vb:rawphrase align_right}" />
just add this behind:
Code:
<img src="{vb:stylevar imgdir_editor}/justify.png" class="imagebutton" id="{vb:raw editorid}_cmd_wrap0_justify" width="20" height="20" alt="Wrap [JUSTIFY] tags around selected text" />
repeat step for "else" part of the same "if" condition


just note that name of BBCODE and id of an image are same id="{vb:raw editorid}_cmd_wrap0_justify
Reply With Quote
  #37  
Old 08-28-2011, 07:42 PM
fly fly is offline
 
Join Date: Oct 2003
Posts: 1,215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

^That template isn't available on 4.15^

Assuming you were posting that as a solution for vB4...
Reply With Quote
  #38  
Old 10-02-2011, 05:19 PM
emperatour emperatour is offline
 
Join Date: Sep 2008
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It appears like the new editor no longer uses "editor_toolbar_on" template....
Reply With Quote
  #39  
Old 11-24-2011, 09:01 AM
cowcowcow cowcowcow is offline
 
Join Date: Jul 2009
Posts: 85
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Using VB3.8

Ive got 20 extra bbcode buttons and the layout just extends horizontally forever, anyone know where to put a linebreak between? Where exactly would i put it?

Alternatively i could center my interface if i knew how to

[/URL] Uploaded with ImageShack.us[/IMG]

thanks!
Reply With Quote
  #40  
Old 02-17-2013, 03:49 AM
bigs15 bigs15 is offline
 
Join Date: Oct 2006
Posts: 73
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Having error after editing the template

Code:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting ']' in
/includes/adminfunctions_template.php(3941) : eval()'d code on line 154
Reply With Quote
  #41  
Old 02-17-2013, 06:34 PM
Digital Jedi's Avatar
Digital Jedi Digital Jedi is offline
 
Join Date: Oct 2006
Location: PopCulturalReferenceLand
Posts: 5,171
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by cowcowcow View Post
Using VB3.8

Ive got 20 extra bbcode buttons and the layout just extends horizontally forever, anyone know where to put a linebreak between? Where exactly would i put it?

Alternatively i could center my interface if i knew how to

[IMG] Uploaded with ImageShack.us[/IMG]

thanks!
You're adding cells to a table when adding them to the editor. So what you need to do is start a new table row, rather than a line break.

HTML Code:
<table> 
                <!-- TR starts a new table row -->
      <tr> 
            <td>Table Cell Contents</td>
            <td>Table Cell Contents</td>
      </tr>
                <!-- TR starts a new table row -->
      <tr>
            <td>Table Cell Contents</td>
            <td>Table Cell Contents</td>
      </tr>
</table>
There need to be an equal number of table cells on each row, or your table will be lopsided. Even if the cells are empty, just a <td></td> will work.

Also, looks to me like you or a modification have made additional edits to your editor template. So you would need to make certain the HTML is correct here before attempting to try and center anything.


Quote:
Originally Posted by bigs15 View Post
Having error after editing the template

Code:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting ']' in
/includes/adminfunctions_template.php(3941) : eval()'d code on line 154
You're code is constructed improperly. You've left out something like a ] that PHP was expecting to be there. You need to double check your work closely, or revert the template and start over all the custom edits from scratch.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:19 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04883 seconds
  • Memory Usage 2,328KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (9)bbcode_code
  • (1)bbcode_html
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (2)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete