Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 187
0 Users 3 Guests Online

Add BBCode to PMs

Real quick.

Go to where you have your inbox/pm system stored.

Where you have

PHP Code
1
<?php


replace it with:

PHP Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
function BBCODE($content){ //define the function of bbcode 
$content nl2br($content); //replaces returns with br's 
$match = array( 
'#\[b\](.*?)\[\/b\]#se'
'#\[i\](.*?)\[\/i\]#se'
'#\[u\](.*?)\[\/u\]#se'
'#\[url=(.*?)\](.*?)\[\/url\]#se'
'#\[url\](.*?)\[\/url\]#se'
'#\[img\](.*?)\[\/img\]#se'
'#\[code\](.*?)\[\/code\]#se'
'#\[php\](.*?)\[\/php\]#se'
'#\[html\](.*?)\[\/html\]#se'
'#\[print\](.*?)\[\/print\]#se' 
); //codes used in posts 
$replace = array( 
"'<b>\\1</b>'"
"'<i>\\1</i>'"
"'<u>\\1</u>'"
"'<a href=\"\\1\" target=\"_BLANK\">\\2</a>'"
"'<a href=\"\\1\" target=\"_BLANK\">\\1</a>'"
"'<img border=\"0\" src=\"\\1\">'"
"'<u><b>Code:</b></u> 
<div style=\"border: 1px dotted #000000; width: 370px; background-color: #CCCCCC;\"> 
'.highlight_string(stripslashes(str_replace('', '', '$1')), true).'</div>'"

"'<u><b>PHP Code:</b></u> 
<div style=\"border: 1px solid #42AC47; width: 370px;background-color: #B1E2B4;> '.highlight_string(stripslashes(str_replace('', '', '$1')), true).'</div>'"

"'<u><b>HTML Code:</b></u> 
<div style=\"border: 1px solid #42AC47; width: 370px;background-color: #CCCCCC;> '.highlight_string(stripslashes(str_replace('', '', '$1')), true).'</div>'"

"'<u><b>Print Out:</b></u> 
<div style=\"border: 1px dotted #000000; width: 370px; background-color: #CCCCCC;> 
'.highlight_string(stripslashes(str_replace('', '', '$1')), true).'</div>'" 
); //replacements 
return preg_replace($match$replace$content); //match, and replace 
//end the function


Now go down to case 'view':

and above the first echo add

PHP Code
1
$bbmsg = BBCODE($message);


then go down a little more. Replace $message with $bbmsg.

Now go to case 'compose'.

Where it says:
PHP Code
1
<b>Subject</b>: <input type=\"text\" name=\"title\" size=\"20\">


Add below it:
PHP Code
1
2
3
4
5
6
7
8
<br><div style='padding-left: 5px; padding-top:5px;'>
<input type='button' value='B' name='btnBold' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;<b>&#39;,&#39;</b>&#39;);'>
<input type='button' value='I' name='btnItalic' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;<i>&#39;,&#39;</i>&#39;);'>
<input type='button' value='U' name='btnUnderline' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;<u>&#39;,&#39;</u>&#39;);'>
<input type='button' value='IMG' name='btnImg' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;<img src="&#39;,&#39;" alt="TutorialNinja Image">&#39;);''>
<input type='button' value='URL' name='btnUrl' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;&#39;,&#39;&#39;);'>
<input type='button' value='PHP' name='btnPHP' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;[php]&#39;,&#39;
&#39;);'></div>
[/php]

And you are done. That BBcode should appear above the message body and below the message title. Enjoy.
UrbanTwitch
Views:
2854
Rating:
Posted on Saturday 13th September 2008 at 12:03 PM
Dalez
Dalez
This part:
Code

<div style='padding-left: 5px; padding-top:5px;'>
<input type='button' value='B' name='btnBold' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;<b>&#39;,&#39;</b>&#39;);'>
<input type='button' value='I' name='btnItalic' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;<i>&#39;,&#39;</i>&#39;);'>
<input type='button' value='U' name='btnUnderline' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;<u>&#39;,&#39;</u>&#39;);'>
<input type='button' value='IMG' name='btnImg' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;<img src="&#39;,&#39;" />&#39;);''>
<input type='button' value='URL' name='btnUrl' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;&#39;,&#39;&#39;);'>
<input type='button' value='PHP' name='btnPHP' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;[php]&#39;,&#39;


Is the little buttons that you press to make them enter into the box named: TheTextArea.

^^
Posted on Thursday 11th September 2008 at 11:24 PM
Dava
Dava
a screenshot would help
Posted on Thursday 11th September 2008 at 09:10 PM
jambomb
jambomb
This part its well buggerd lol

Code



<div style='padding-left: 5px; padding-top:5px;'>
<input type='button' value='B' name='btnBold' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;<b>&#39;,&#39;</b>&#39;);'>
<input type='button' value='I' name='btnItalic' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;<i>&#39;,&#39;</i>&#39;);'>
<input type='button' value='U' name='btnUnderline' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;<u>&#39;,&#39;</u>&#39;);'>
<input type='button' value='IMG' name='btnImg' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;<img src="&#39;,&#39;" />&#39;);''>
<input type='button' value='URL' name='btnUrl' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;&#39;,&#39;&#39;);'>
<input type='button' value='PHP' name='btnPHP' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;[php]&#39;,&#39;


Posted on Thursday 11th September 2008 at 04:44 PM
Dava
Dava
what do u mean messed up
Posted on Thursday 11th September 2008 at 03:51 PM
jambomb
jambomb
I know but the codes messed up on my screen then and it doesnt work
Posted on Wednesday 10th September 2008 at 11:06 PM
Dava
Dava
jambomb its pretty easy if you read
Posted on Wednesday 10th September 2008 at 04:51 PM
jambomb
jambomb
?
Posted on Monday 18th August 2008 at 01:45 PM
jambomb
jambomb
please can some one simple this out a bit ? :)
Posted on Saturday 16th August 2008 at 12:13 PM
jambomb
jambomb
?
Posted on Thursday 14th August 2008 at 03:15 PM
jambomb
jambomb
This is really confusing can some 1 just simple it out a bit :S