adding BBcode buttons

This forum is now closed as part of retiring phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
phildcan
Registered User
Posts: 21
Joined: Fri Dec 16, 2005 8:54 pm
Contact:

adding BBcode buttons

Post by phildcan » Tue Dec 20, 2005 4:03 pm

I have a new bbcode installed and it works great no problems but I would like to have the button on the posting pages so that my users dont have to type out [item][/item] all the time.

anyone know how to do this?

Thanks in advance as always!

User avatar
mikeablah
Registered User
Posts: 80
Joined: Sun Sep 11, 2005 10:36 pm
Location: New York City

Post by mikeablah » Wed Dec 21, 2005 8:24 am

Im trying to get something done like this as well.

Im guessing you need it as well for WoW itemstats. Anyways, I went throught the BBcode faq. Downloaded and installed the 2 mods. Now Im trying to add a simple [item] code but I just cant get it to work for 2.0.18

phildcan
Registered User
Posts: 21
Joined: Fri Dec 16, 2005 8:54 pm
Contact:

Post by phildcan » Wed Dec 21, 2005 4:18 pm

yuppers, WoW itemstats, its one of the coolest mods i think. But I hate typing out the [item] code.

Anyone out there know how to add a BBcode button to the list...

you know to look like:

[QOUTE]

Code: Select all

 [LIST] [LIST=] [IMG] [URL] [ITEM]


[ITEM] being the new one of course.

the code that is used for the mod is 


[item]ItemName[/item] 


Thanks.

Blankety Blank Man
Registered User
Posts: 881
Joined: Wed Mar 30, 2005 3:54 am

Post by Blankety Blank Man » Wed Dec 21, 2005 6:46 pm

if you have the MultiBBCode MOD installed (which you ought to if you're adding BBCodes), you just have to add the name of the button to one array (mb_names? something like that) and the width of the button to another array (mb_widths?)
they should be in the MultiBBCode() function, which is, IIRC, in posting.php

then add helpline stuff to lang/lang_{language}/lang_bbcode.php

phildcan
Registered User
Posts: 21
Joined: Fri Dec 16, 2005 8:54 pm
Contact:

Post by phildcan » Wed Dec 21, 2005 7:33 pm

are you saying i have to add a whole new mod just for 1 button?

Cant I just add something to the posting.php or bbcode.php or something

User avatar
mikeablah
Registered User
Posts: 80
Joined: Sun Sep 11, 2005 10:36 pm
Location: New York City

Post by mikeablah » Wed Dec 21, 2005 7:54 pm

Yea, you gotta install MultiBBcode and the organizer one. Its very difficult without it.

User avatar
mikeablah
Registered User
Posts: 80
Joined: Sun Sep 11, 2005 10:36 pm
Location: New York City

Post by mikeablah » Wed Dec 21, 2005 8:10 pm

Blankety Blank Man wrote: if you have the MultiBBCode MOD installed (which you ought to if you're adding BBCodes), you just have to add the name of the button to one array (mb_names? something like that) and the width of the button to another array (mb_widths?)
they should be in the MultiBBCode() function, which is, IIRC, in posting.php

then add helpline stuff to lang/lang_{language}/lang_bbcode.php


http://www.phpbb.com/kb/article.php?article_id=147

dont see anything mentioned on posting.php

In the itemstats mod we are talking about, these files were edited but no button were made. Just need a simple thing to drop [item] tags. So

Code: Select all

3. PHPBB modifications

Follow the instructions below to modify the phpbb files with data specific to your environment.  This can vary from version to version.  The goal is to inject a call to 'itemstats_parse()' in the location where the forum bbcodes are handled.  In my installation, the main entry point for this is the  bencode_second_pass() function, so I added the call at the beginning of this function.  For the HTML changes, the goal is to have allakhazam.css and Overlib loaded for forum page that will display itemstats.  For simplicity, I put this in the 'overall_healer.tpl' file.  The changes listed below are for the default subSilver template.  If you are using multiple templates for your forum, you will need to apply it to each one.

These changes do not follow any BBCode mod standards.  I tried to do that, but it was too complicated for my taste.  I wanted to make the smallest possible change in the phpbb php code, something that would be easy to fix if a phpbb patch somehow overwrote it somehow.

OPEN
{forum_root}/include/bbcode.php

FIND
define("BBCODE_UID_LEN", 10);

ADD-AFTER
include('./itemstats/phpbb_itemstats.php');

FIND
function bbencode_second_pass($text, $uid)
{
	global $lang, $bbcode_tpl;

ADD-AFTER
	// Parse text for ItemStats mod
	$text = itemstats_parse($text);

SAVE AND CLOSE
{forum_root}/include/bbcode.php

OPEN
{forum_root}/templates/subSilver/overall_header.tpl

FIND
<!-- link rel="stylesheet" href="templates/subSilver/{T_HEAD_STYLESHEET}" type="text/css" -->

ADD-AFTER
<link rel="stylesheet" href="itemstats/templates/itemstats.css" type="text/css">
<script type="text/javascript" src="itemstats/overlib/overlib.js"><!-- overLIB (c) Erik Bosrup --></script>

SAVE AND CLOSE
{forum_root}/templates/subSilver/overall_header.tpl
Im going to keep trying though, I want to start learning this stuff so I can understand it.

phildcan
Registered User
Posts: 21
Joined: Fri Dec 16, 2005 8:54 pm
Contact:

Post by phildcan » Wed Dec 21, 2005 11:32 pm

well seeing as no one helped here.... I FIGURED IT OUT!!

Code: Select all


open   \templates\subSilver\posting_body.tpl

find:

bbcode = new Array();
bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','
','
  • ','
','
  • ','
','[img]','[/img]','','',);

replace it with:

bbcode = new Array();
bbtags = new Array('','','','','','','[quote]','[/quote]','

Code: Select all

','
','
  • ','
','
  • ','
','[img]','[/img]','','','[item]','[/item]');

find:

</span></td>
</tr>
<tr>
<td colspan="9">

add; before:

</span></td>
<td><span class="genmed">
<input type="button" class="button" accesskey="t" name="addbbcode18" value="Item" style="width: 40px" onClick="bbstyle(18)" onMouseOver="helpline('t')" />

close and exit.
[/code]

worked for me. let me know.

xythian
Registered User
Posts: 6
Joined: Fri Jan 20, 2006 1:59 pm

Post by xythian » Sat Jan 21, 2006 3:38 pm

I added a couple of steps for people who would like to add a mouseover help line.

Code: Select all

# 
#-----[ OPEN ]------------------------------------------
# 
templates/subSilver/posting_body.tpl

# 
#-----[ FIND ]------------------------------------------ 
# 
f_help = "{L_BBCODE_F_HELP}"; 

# 
#-----[ AFTER, ADD ]------------------------------------------
# 
t_help = "{L_BBCODE_T_HELP}";

# 
#-----[ FIND ]--------------------------------- 
# 
# NOTE: the actual line to find is MUCH longer, containing all the bbcode tags 
bbtags = new Array( 

# 
#-----[ IN-LINE FIND ]--------------------------------- 
# 
'[url]','[/url]' 

# 
#-----[ IN-LINE AFTER, ADD ]--------------------------------- 
# 
,'[item]','[/item]'

# 
#-----[ FIND ]------------------------------------------
# 
			<td><span class="genmed"> 
			  <input type="button" class="button" accesskey="w" name="addbbcode16" value="URL" 

style="text-decoration: underline; width: 40px" onClick="bbstyle(16)" onMouseOver="helpline('w')" />
			  </span></td>
# 
#-----[ AFTER, ADD ]------------------------------------------
# 
#Be sure to increase the "addbbcode" numbers by 2 if neccessary 
# 
 <td><span class="genmed">
           <input type="button" class="button" accesskey="t" name="addbbcode18" value="Item" style="width: 40px" 

onClick="bbstyle(18)" onMouseOver="helpline('t')" /> 
			  </span></td>		

# 
#-----[ SAVE, CLOSE ]------------------------------------------
# 
templates/subSilver/posting_body.tpl

# 
#-----[ OPEN ]------------------------------------------
# 
posting.php

# 
#-----[ FIND ]------------------------------------------
# 
# NOTE: the full line to look for is: 	
'L_BBCODE_F_HELP' => $lang['bbcode_f_help'], 

# 
#-----[ AFTER, ADD ]------------------------------------------
# 
'L_BBCODE_T_HELP' => $lang['bbcode_t_help'],

# 
#-----[ SAVE, CLOSE ]------------------------------------------
# 
posting.php

# 
#-----[ OPEN ]------------------------------------------
# 
language/lang_english/lang_main.php

# 
#-----[ FIND ]------------------------------------------
# 
# NOTE: the full line to look for is: 
$lang['bbcode_f_help'] = 'Font size: [size=x-small]small text[/size]';

# 
#-----[ AFTER, ADD ]------------------------------------------
# 
$lang['bbcode_t_help'] = 'WoW item link: [item]item name[/item]  (alt+t)';

# 
#-----[ SAVE, CLOSE ]------------------------------------------
# 
language/lang_english/lang_main.php
# EoM 

If you would like to edit the BBCode FAQ, I suggest using the FAQ Edit MOD.
http://www.phpbb.com/phpBB/catdb.php?mode=download&id=843347

phildcan
Registered User
Posts: 21
Joined: Fri Dec 16, 2005 8:54 pm
Contact:

Post by phildcan » Wed Feb 08, 2006 6:50 pm

I fixed this so that it works with Easymod.

Code: Select all

##############################################################
## MOD Title: BBcode for Itemstats
## MOD Author: Multiple
## MOD Description: Adds a BBcode button to the posting page for [item][/item]; This is to beinstalled after Itemstats is working.
## MOD Version: 1.0.0
##
## Installation Level:	Easy
## Installation Time:	1 Minute
## Files To Edit: posting_body.tpl; posting.php; lang_main.php
##
## Included Files: n/a
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes: Can be installed with Easymod.
##
##
##############################################################
## MOD History:
##
##	2006-08-02  - Initial version - 1.0.0
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

# 
#-----[ OPEN ]------------------------------------------ 
# 
templates/subSilver/posting_body.tpl 

# 
#-----[ FIND ]------------------------------------------ 
# 
f_help = "{L_BBCODE_F_HELP}";

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
t_help = "{L_BBCODE_T_HELP}"; 

# 
#-----[ FIND ]--------------------------------- 
# 
# 
bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','
','
  • ','
','
  • ','
','[img]','[/img]','','');

#
#-----[ IN-LINE FIND ]---------------------------------
#
'',''

#
#-----[ IN-LINE AFTER, ADD ]---------------------------------
#
,'[item]','[/item]'

#
#-----[ FIND ]------------------------------------------
#
<td><span class="genmed">
<input type="button" class="button" accesskey="w" name="addbbcode16" value="URL" style="text-decoration: underline; width: 40px" onClick="bbstyle(16)" onMouseOver="helpline('w')" />
</span></td>
#
#-----[ AFTER, ADD ]------------------------------------------
#
#Be sure to increase the "addbbcode" numbers by 2 if neccessary..if you already have name="addbbcode18"
#Increase it to name="addbbcode20"
#
<td><span class="genmed">
<input type="button" class="button" accesskey="t" name="addbbcode18" value="Item" style="width: 40px" onClick="bbstyle(18)" onMouseOver="helpline('t')" />
</span></td>

#
#-----[ OPEN ]------------------------------------------
#
posting.php

#
#-----[ FIND ]------------------------------------------
#
# NOTE: the full line to look for is:
'L_BBCODE_F_HELP' => $lang['bbcode_f_help'],

#
#-----[ AFTER, ADD ]------------------------------------------
#
'L_BBCODE_T_HELP' => $lang['bbcode_t_help'],

#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php

#
#-----[ FIND ]------------------------------------------
#
#
$lang['bbcode_f_help'] = 'Font size: [size=x-small]small text[/size]';

#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['bbcode_t_help'] = 'WoW item link: [item]item name[/item] (alt+t)';

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM[/code]

Download here: Item Stats BBcode

ItemStats Mod can be found here: http://forums.eqdkp.com/index.php?showtopic=1768

Credit to Draco for a awsome MOD !!

RevRoF
Registered User
Posts: 1
Joined: Mon Apr 03, 2006 1:25 pm

Post by RevRoF » Mon Apr 03, 2006 1:34 pm

Edit: Never mind. It works now.

:)

User avatar
GeodesicDragon
Registered User
Posts: 23
Joined: Thu Mar 08, 2007 12:42 am

Re: adding BBcode buttons

Post by GeodesicDragon » Fri Jul 04, 2008 1:38 pm

I done it by going to my Custom BBCodes, and adding this:

Code: Select all

<script language="JavaScript" type="text/javascript">document.write("[item][/item]")</script>
Works a treat - no faffing around needed.

User avatar
Lumpy Burgertushie
Registered User
Posts: 65044
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: adding BBcode buttons

Post by Lumpy Burgertushie » Fri Jul 04, 2008 7:07 pm

GeodesicDragon wrote:I done it by going to my Custom BBCodes, and adding this:

Code: Select all

<script language="JavaScript" type="text/javascript">document.write("[item][/item]")</script>
Works a treat - no faffing around needed.
did you look at the date of the post you replied to?

it is over two years old.

also, I believe you are talking about phpbb3 and the is a phpbb2 forum.


robert
I am available for custom work on a donation basis. Please send me a PM with your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

OK, so what's the speed of dark?

Post Reply

Return to “[2.0.x] MOD Requests”

Who is online

Users browsing this forum: No registered users and 8 guests