Syntax Highlighter

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in the Customisations Database.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTICE: This forum is only for the announcement of new releases and/or updates of MODs. Any MOD support should be obtained through the Customisations Database in the support area designated for each MOD.

A direct link to support for each MOD is in the first post of the respective topic.
Locked
Markstar
Registered User
Posts: 72
Joined: Mon May 01, 2006 6:26 pm

Re: Syntax Highlighter

Post by Markstar » Sat Mar 20, 2010 11:47 am

Hi!
UseLess wrote:Greetings,

1. The latter.
:D That's great! I shall keep an eye out on the other page in hope of finding new versions there in the future (even though you said no future versions will be released, so I'm still a little confused about this). :P
2. Select will include the line numbers, if shown, which is why, in the version I use, I removed the 'select' option and left the 'download' option so the code can be downloaded with the layout intact with no line numbers or anything else included. It's also handier if you specify a filename so the downloaded code can be opened directly in a appropriate application. But if you want to stick with the select option then I'd suggest using another select script that doesn't include the line numbers.
Ups...I just saw that when I click on [ Select ], it would (correctly) only select the code itself. But since actually copies everything to the clipboard I do have to think about which option makes more sense. But I think I still want line numbers, so you are right (of course), [ Select ] makes less sense then and [ Download ] seems to be the better option, since I can't code an alternative "Select" script myself and I can't find any on the net.
3. In the 'if ... else ...' where the lines parameter is checked change the 'else' default 'no line numbers' to whatever lines you want 'normal' or 'fancy'.
I'm sorry, I don't know which if-clause you are referring to. :oops:
Bogey said to change the $params variable, which then appears in two successive "if($tag_valid"-clauses (which, btw, I don't understand why they are separate instead of just one). I don't see a "no line numbers" option anywhere. :oops:
4. Reminder sent...
Got it. Thank you!

User avatar
UseLess
Registered User
Posts: 521
Joined: Mon Jul 22, 2002 7:26 pm
Location: North East UK

Re: Syntax Highlighter

Post by UseLess » Sat Mar 20, 2010 3:05 pm

Greetings,

The 'if' clause I'm referring to starts on line 420 and ends on line 446, to change the default behaviour to always show line numbers change the 'else' part like so:

Option 1 normal line numbers:

Code: Select all

else
{							
	// Make line type not empty as a syntax is specified
	$line_type = 'not empty';
	$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
}
Option 2 fancy line numbers

Code: Select all

else
{							
	// Make line type not empty as a syntax is specified
	$line_type = 'not empty';
	$fancy = ( isset($item['params']['fancy']) ? trim(htmlspecialchars($item['params']['fancy'])) : 5);
	$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, $fancy);
}
If you don't specify a language then you should always get line numbers, i.e. using the [syntax] tag with no options, you should also be able to highlight lines by using the 'highlight' parameter. The highlight parameter does not work when a language is specifed, this was changed in a later version to use GeSHi as it has it's own highlighter.

If you do speciafy a language with either: lang=php or use the lang tag option then line numbers won't be shown by default, making the above change will change the default behaviour.
Movie Quote:
It's not the years honey, it's the mileage...
phpBB 3 Mods @ phpBBStyles

Markstar
Registered User
Posts: 72
Joined: Mon May 01, 2006 6:26 pm

Re: Syntax Highlighter

Post by Markstar » Mon Mar 22, 2010 3:13 pm

It's working perfectly now and I have it set up the same way as you now. :D

Thank you, UseLess!

Kevin49
Registered User
Posts: 21
Joined: Wed May 05, 2010 3:24 pm

Re: Syntax Highlighter

Post by Kevin49 » Wed May 05, 2010 3:28 pm

Greetings everybody,
I'm truly willing to put this mod on my phpbb3 (very last version).
I've followed the installation guide and installed Geshi on my forum.
However, I encounter the following php error (at the top of my forum) after typing (example) :

Code: Select all

[code=java]code
[/code]

The error is the following :

Code: Select all

[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 599: include_once(./includes/geshi/geshi.php) [function.include-once]: failed to open stream: No such file or directory
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 599: include_once() [function.include]: Failed opening './includes/geshi/geshi.php' for inclusion (include_path='.:/usr/local/lib/php')
geshi n'a pas pu être![phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3542)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4368: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3542)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4369: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3542)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4370: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3542)
Any Idea?
Thanks ;)

User avatar
UseLess
Registered User
Posts: 521
Joined: Mon Jul 22, 2002 7:26 pm
Location: North East UK

Re: Syntax Highlighter

Post by UseLess » Wed May 05, 2010 10:45 pm

Greetings,

Have you tried using:

Code: Select all

[syntax=java]code[/syntax]
because unless you've altered the class to override the code tag using the code tag will only work with the 'code=php' option. And the '=java' is stripped out anyway, well it is on my 3.0.7 installation.

If the option to add the languages as tags is enabled, use the [version /] tag to check this, then you could use:

Code: Select all

[java]code[/java]
Movie Quote:
It's not the years honey, it's the mileage...
phpBB 3 Mods @ phpBBStyles

Kevin49
Registered User
Posts: 21
Joined: Wed May 05, 2010 3:24 pm

Re: Syntax Highlighter

Post by Kevin49 » Thu May 06, 2010 3:08 pm

Thank you for this answer. Indeed using [java]code[/java] works!
unless you've altered the class to override the code tag using the code tag
Um... Is there any tips on how doing this please?

Locked

Return to “[3.0.x] MOD Database Releases”