[2.0.6] PHP Syntax Highlighter BBCode

The cleanup is complete. This forum is now read only.
Post Reply

Rating:

Excellent!
30
60%
Very Good
5
10%
Good
3
6%
Fair
1
2%
Poor
11
22%
 
Total votes: 50

AbelaJohnB
Former Team Member
Posts: 5674
Joined: Fri Jul 06, 2001 11:56 pm

[2.0.6] PHP Syntax Highlighter BBCode

Post by AbelaJohnB » Wed Jul 16, 2003 6:29 am

MOD Name: PHP Syntax Highlighter BBCode
Author: Fubonis
MOD Description: Highlights PHP specific code when used.

MOD Version: 3.0.3 (updated: 08/08/03)


Download File: PHPBBCode303.mod
File Size: 10436 Bytes
Last edited by AbelaJohnB on Mon Apr 30, 2007 12:28 am, edited 3 times in total.

AbelaJohnB
Former Team Member
Posts: 5674
Joined: Fri Jul 06, 2001 11:56 pm

Post by AbelaJohnB » Thu Jul 17, 2003 10:07 am

MOD Validated/Released :mrgreen:

CyanBlue
Registered User
Posts: 409
Joined: Mon Jul 28, 2003 9:55 am

Post by CyanBlue » Wed Jul 30, 2003 2:00 pm

Thank you for the great MOD, Fubonis... It's working great... ;)

I have a couple of questions though...

I see that you are editing privmsg.php file... and I DO see the PHP code being highlighted if I manually enclose the PHP code within the [ PHP] ... [ /PHP] tag, but I do not see the 'PHP' button as I do see in the regular thread post mode... Am I missing something here or is it how it is with this MOD??? (Sorry, if I am asking dumb question... It's my fourth day with phpBB... and I am not good at PHP either...)

Since I am here, I gotta ask a couple more questions... :D
How hard will it be to add the indentation to the given PHP code???
It'd be great if the indentation can be done automatically...

How hard will it be to support another language rather than PHP???
I am looking for the syntax highlighter for the ActionScript which is the scripting language for Flash, but I am not able to find that sort of MOD...

Can somebody also point me to the routine/line within this MOD that checks if the given word is the PHP reserved word???
I have a feeling that this function,

Code: Select all

function bbencode_second_pass_php($text, $uid, $bbcode_tpl)
{
   ...
}
is the one that takes care of it, but I do not quite understand how this function works... If I understand the routine correctly, I have a chance to try to create ActionScript tag... Oh, well... Someday, I will... :)

Thank you for your great MOD again and thank you for taking time to read this... :)

Jason

CyanBlue
Registered User
Posts: 409
Joined: Mon Jul 28, 2003 9:55 am

Post by CyanBlue » Wed Jul 30, 2003 4:50 pm

Hm... It is abit strange... :(

As I was saying, my initial test was working just fine on Classic theme...

So, I started doing the same modification on all other themes...

They do work great, but I am having problem with subSilver and Eos themes... [ PHP] ... [ /PHP] tag works if I type them manually, but there seems like some sort of JavaScript error after applying this MOD...

Can somebody care to take a look at this???
If you want to see what sort of thing is really happening, you can try this site...

You should be able to see the JavaScript errors on the status bar as soon as you press 'Reply' button on that thread as long as you are set to Eos or subSilver theme...

If it helps, here are a couple of files that needed to be modified along with the instruction... (Done following Multiple BBCode MOD and PHP Syntax Highlighter BBCode MOD instruction...)

I'm on W2K/IE6/phpBB 2.0.5 and the server is Linux if it matters...

Thank you for your time... ;)

Jason, frustrated four day old newbie...


This is the posting_body.tpl of subSilver theme...

Code: Select all

// Insert at Claret position. Code from
// http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130
function storeCaret(textEl) {
	if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}

/////// Now, I get it...  Thanks alot!!!  :) ///////

function dsListUsernames() {
	var user_popup = window.open('./list_usernames.php', 'usernames', 'width=300, height=275, toolbar=false, 
statusbar=false, menubar=false, scrollbars=false, alwaysraised=true');	return;
}

//-->
Last edited by CyanBlue on Wed Jul 30, 2003 6:19 pm, edited 2 times in total.

Fubonis
Registered User
Posts: 359
Joined: Sun Dec 02, 2001 6:05 am
Contact:

Post by Fubonis » Wed Jul 30, 2003 5:14 pm

You need to fix the dsListUsernames function. Replace it with this one:

Code: Select all

function dsListUsernames() {
	var user_popup = window.open('./list_usernames.php', 'usernames', 'width=300, height=275, toolbar=false, statusbar=false, menubar=false, scrollbars=false, alwaysraised=true');
	return;
}
The original code gave a JavaScript error; it had a new line in the string argument which I guess messed up everything else. Give that a try.
phpBB, more like idon'tlikeyouorwhatyoupostedsoi'lllockyourtopicandthendeleteitBB m i rite???

CyanBlue
Registered User
Posts: 409
Joined: Mon Jul 28, 2003 9:55 am

Post by CyanBlue » Wed Jul 30, 2003 6:15 pm

The original code gave a JavaScript error; it had a new line in the string argument which I guess messed up everything else.

Huh??? Are you saying that there was some sort of mysterious invisible newline character within the given function, or there was actual carriage return in an unnecessary place???

<<< There was an actual carriage return and it looks like that was my fault... :) >>>

Dang... Anyways, I think that solved the problem... I really appreciate your help, and am grateful to your good MOD... :)

Can you please take a look at my first reply on this thread and shed some light on my curious mind???

Much appreciate your time and effort...

Have a nice day... :)

Jason

User avatar
TimeVirus
Registered User
Posts: 125
Joined: Sat Jul 12, 2003 12:17 am

Post by TimeVirus » Wed Jul 30, 2003 7:43 pm

Hmm, why is it mod makers always seem to neglect thorough descriptions of their works... and only sometimes provide demo sites.

I take it that this makes editing posts easier by changing the color of the formatting codes? That would be slick if thats what it does, but I've read this several times and am still not sure.
I'm probably wrong again...

User avatar
GPHemsley
Registered User
Posts: 1475
Joined: Fri Apr 18, 2003 3:12 am
Location: Long Beach, NY
Name: Gordon Hemsley
Contact:

Post by GPHemsley » Wed Jul 30, 2003 8:14 pm

TimeVirus wrote: Hmm, why is it mod makers always seem to neglect thorough descriptions of their works... and only sometimes provide demo sites.

I take it that this makes editing posts easier by changing the color of the formatting codes? That would be slick if thats what it does, but I've read this several times and am still not sure.

This MOD colors certain PHP words, similar to if you had a .phps file. It shows certain things in certain colors (for PHP code only) instead of the all green for regular code.

User avatar
TimeVirus
Registered User
Posts: 125
Joined: Sat Jul 12, 2003 12:17 am

Post by TimeVirus » Wed Jul 30, 2003 8:47 pm

GPH, I didn't understand most of the acronyms or buzzwords (again) but I think you're saying that when posting examples of code in a thread, php specific portions ot that sample will be automatically highlighted within the codeblock in your post.

Ah well, thats pretty cool, but what I first thought it was would have been really handy. :) Dang. :P
I'm probably wrong again...

phpcenter
Registered User
Posts: 7
Joined: Mon Feb 10, 2003 4:02 pm
Contact:

Post by phpcenter » Sun Aug 03, 2003 4:08 pm

Hi folks!

Sience I installed the Mod "PHP Syntax Highlighter v3.02" I have always an error, when I open a topic for reading. In the middle of the page, there is an error:
Quote:

Code: Select all

Parse error: parse error, unexpected '<' in /***/forum/includes/bbcode.php(61) : eval()'d code on line 39
You can see this error 1:1 @ http://www.ks1.ch/phpscripts/forum/view ... ?p=410#410

Can somebody help me?

Thank you!!
Best regards!
Andy

User avatar
GPHemsley
Registered User
Posts: 1475
Joined: Fri Apr 18, 2003 3:12 am
Location: Long Beach, NY
Name: Gordon Hemsley
Contact:

Post by GPHemsley » Sun Aug 03, 2003 5:09 pm

I don't see any error on that page....

phpcenter
Registered User
Posts: 7
Joined: Mon Feb 10, 2003 4:02 pm
Contact:

Post by phpcenter » Sun Aug 03, 2003 5:40 pm

Hi

Oh yes! I replaced the changed files, because no BBCode is working (No Bold, no Italic, no URL!)

The Errormessage stands over the "new Topic"-Button! In all topics I get this Message: Parse error: parse error, unexpected '<' in /***/forum/includes/bbcode.php(61) : eval()'d code on line 39

Can you help me or do i must change the files so you can see where the message is?
Best Regards!
Andy

ProjectGSX
Registered User
Posts: 43
Joined: Mon Apr 14, 2003 3:17 pm
Location: Austin, TX
Contact:

Post by ProjectGSX » Mon Aug 04, 2003 8:19 pm

After installing this mod I get the following error when viewing posts that have the php code in them:

Doing: [php]test[/php]

yields: [php:1:34bc6c735b]test[/php:1:34bc6c735b]

User avatar
BigSepp
Registered User
Posts: 14
Joined: Sun Jan 13, 2002 11:01 am
Contact:

Post by BigSepp » Tue Aug 05, 2003 9:59 am

is their an update for 2.0.6 ... because I can't find the text after wich you have to put the modifications in posting.php :(

ProjectGSX
Registered User
Posts: 43
Joined: Mon Apr 14, 2003 3:17 pm
Location: Austin, TX
Contact:

Post by ProjectGSX » Tue Aug 05, 2003 2:23 pm

ProjectGSX wrote: After installing this mod I get the following error when viewing posts that have the php code in them:

Doing: [php]test[/php]

yields: [php:1:34bc6c735b]test[/php:1:34bc6c735b]


Any help here would be appreciated.

Thanks!

Post Reply

Return to “[2.0.x] MOD Database Cleanup”