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.
SudaNix
Registered User
Posts: 2
Joined: Sun Aug 16, 2009 6:39 pm

Re: Syntax Highlighter

Post by SudaNix »

Hello, I use this mod in rtl (Arabic) version of phpbb3 and subsliver2 style.

the problem is the code direction now is right to left !
How i can fix it and make it left to right ?

thanks in advance.
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 »

Greetings,

Try the following changes:

Code: Select all

# 
#-----[ OPEN ]-------------------------------------------------------
#

styles/subsilver2/theme/ul_syntax_highlighter.css

# 
#-----[ FIND ]-------------------------------------------------------
#

.postbody .syntax {

# 
#-----[ AFTER, ADD ]-------------------------------------------------
# 

	direction: ltr;

# 
#-----[ FIND ]-------------------------------------------------------
#

.postbody .syntax-header {

# 
#-----[ AFTER, ADD ]-------------------------------------------------
# 

	direction: ltr;

# 
#-----[ FIND ]-------------------------------------------------------
#

.syntax-content {

# 
#-----[ AFTER, ADD ]-------------------------------------------------
# 

	direction: ltr;

# 
#-----[ OPEN ]-------------------------------------------------------
#

includes/hooks/hook_syntax_highlighter.php

# 
#-----[ FIND ]-------------------------------------------------------
#
# Note: The following are not complete lines...

					$geshi->set_overall_style(
					$geshi->set_line_style(

# 
#-----[ REPLACE WITH ]----------------------------------------------- 
#
# Note: Replace the 2 lines found above with the following.

					$geshi->set_overall_style('direction: ltr; font-family: Monaco, \'Courier New\', monospace; margin-left: 15px;');
					$geshi->set_line_style(' font-size: 1.0em; font-weight: normal; font-family: \'Courier New\', Courier, monospace; color: #003030; border-bottom: 1px #E0E0E0 solid; margin-left: 35px;', 'font-weight: bold; color: #006060; margin-left: 35px', true);

# 
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------------- 
# 
# EoM
Movie Quote:
It's not the years honey, it's the mileage...
phpBB 3 Mods @ phpBBStyles
SudaNix
Registered User
Posts: 2
Joined: Sun Aug 16, 2009 6:39 pm

Re: Syntax Highlighter

Post by SudaNix »

Thanks very much, its work now .

but if i used line numbers it became right to left ,again!
note: there is no "set_overall_style" function in the hook_syntax_highlighter.php ,but i make it before "set_line_style".

I have another question, i want to replace original code tag {code}...{/code}
with {syntax="cpp-qt"}...{/syntax} ?

Last one, Hide link doesn't work ?

thanks for helping.
User avatar
MartectX
Registered User
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: Syntax Highlighter

Post by MartectX »

This is one of the sweetest modifications I've spotted so far! :D
silvios
Registered User
Posts: 2
Joined: Thu Sep 03, 2009 6:19 am

Re: Syntax Highlighter

Post by silvios »

i have to assume i did something wrong. I did all thefile edits, and recached my site, but the code tags do nothing.

[php] code.. [/php] Nothing.

[syntax="php"]code.[/syntax] nothing

I get no errors or anything.

Am i supposed to install a file or something? I uploaded all the files, and made all the file edits.
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 »

Greetings,

Make sure you clear the cache and refresh the templates/theme after you've uploaded the files.

Also the [php] tag won't work by default unless you've also made the changes detailed in the 'contrib/lang_as_bbcode_tag.txt' file.
Movie Quote:
It's not the years honey, it's the mileage...
phpBB 3 Mods @ phpBBStyles
silvios
Registered User
Posts: 2
Joined: Thu Sep 03, 2009 6:19 am

Re: Syntax Highlighter

Post by silvios »

When the first edit it removed, the code works, not sure why.
Spinalkord
Registered User
Posts: 2
Joined: Sun Sep 13, 2009 3:04 pm

Re: Syntax Highlighter

Post by Spinalkord »

Hi there everyone.

I have just started to use the syntax highlighter and I wanted a button next to the "Code" button but could not find any info out there on how to do it. After three days playing with the code and many trials and errors I figured it out. (I know i was a bit slow.)

I am posting my solution because I know that there will be others out there that would probably want the same feature.

Open --> styles\stylename\template\posting_buttons.html
Find

Code: Select all

var bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','
','
  • ','
','
  • ','
','[img]','[/img]','','','[flash=]', '[/flash]','[size=]','[/size]'<!-- BEGIN custom_tags -->, {custom_tags.BBCODE_NAME}<!-- END custom_tags -->);[/code]

Replace with

Code: Select all

var bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','
','
  • ','
','
  • ','
','[img]','[/img]','','','[flash=]', '[/flash]','[size=]','[/size]','[syntax="cpp"]','[/syntax]'<!-- BEGIN custom_tags -->, {custom_tags.BBCODE_NAME}<!-- END custom_tags -->);[/code]


Then find

Code: Select all

t: '{LA_BBCODE_T_HELP}',
			tip: '{L_STYLES_TIP}'
Replace with

Code: Select all

t: '{LA_BBCODE_T_HELP}',
			cpp: 'Add C++ Syntax Highlighting to selected text.',
			tip: '{L_STYLES_TIP}'
Then find :

Code: Select all

<input type="button" class="btnbbcode" accesskey="c" name="addbbcode8" value="Code" style="width: 40px" onclick="bbstyle(8)" onmouseover="helpline('c')" onmouseout="helpline('tip')" />
After this add :

Code: Select all

<input type="button" class="btnbbcode" accesskey="cpp" name="addbbcode22" value="C++" style="width: 40px" onclick="bbstyle(22)" onmouseover="helpline('cpp')" onmouseout="helpline('tip')" />
Now Clear the "Cache" folder (using your ftp program go to the folder select all files bar the htaccess file and delete)

Then Save the document and upload it and over write it.

Hope this works for everyone.
btw I use Cpp hance the cpp tag.

You can change it to any syntax language you want.
Example

Spinalkord.
User avatar
euer GEHIRN
Registered User
Posts: 17
Joined: Mon May 25, 2009 9:22 pm
Location: Germany

Re: Syntax Highlighter

Post by euer GEHIRN »

nice MOD ;)

do you have a solution for that problem: http://www.phpbbstyles.co.uk/info/viewt ... rt=50#p222 (forum style get destroyed) :?:
mfg brain_

-sorry for my bad english-
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 »

Greetings,

For some very, very strange reason the layout is only broken with the CA Gen 2 style, as on my local test forum I'm using ProSilver and it works as it should.
Movie Quote:
It's not the years honey, it's the mileage...
phpBB 3 Mods @ phpBBStyles
User avatar
euer GEHIRN
Registered User
Posts: 17
Joined: Mon May 25, 2009 9:22 pm
Location: Germany

Re: Syntax Highlighter

Post by euer GEHIRN »

and subsilver2 ? (or subsilver2 based styles??!)
mfg brain_

-sorry for my bad english-
dohaduc
Registered User
Posts: 1
Joined: Sun Apr 26, 2009 1:48 pm

Re: Syntax Highlighter

Post by dohaduc »

I have an error on http://www.hoitinhoc.vn/viewtopic.php?f ... p=612#p612

Code: Select all

[phpBB Debug] PHP Notice: in file /includes/geshi.php on line 2151: preg_match() [function.preg-match]: Compilation failed: unrecognized character after (?< at offset 3
[phpBB Debug] PHP Notice: in file /includes/geshi.php on line 2151: preg_match() [function.preg-match]: Compilation failed: unrecognized character after (?< at offset 3
Help!

I think the problem with the "tab" char.
Pr00f
Registered User
Posts: 1
Joined: Fri Oct 09, 2009 11:24 am

Re: Syntax Highlighter

Post by Pr00f »

So, for a great bbcode box, do this

open root/phpbb/styles/yourtemplate/posting_buttons.html

search for:

Code: Select all

t: '{LA_BBCODE_T_HELP}',
After, add:

Code: Select all

x: 'Insert Code: [syntax="language"]source code[/syntax]',
Search for:

Code: Select all

<!-- BEGIN custom_tags -->
After, add:

Code: Select all

<select class="gensmall" name="addbbcode69" onchange="bbfontstyle('[syntax="' + this.form.addbbcode69.options[this.form.addbbcode69.selectedIndex].value + '"]', '[/syntax]');" onmouseover="helpline('x')" onmouseout="helpline('tip')">
			  <option value="" selected="selected">Inserir Codigo</option>
			  <option value="abap">ABAP</option>
                <option value="actionscript">ActionScript</option>
                <option value="actionscript3">ActionScript 3</option>
                <option value="ada">Ada</option>
                <option value="apache">Apache configuration</option>
                <option value="applescript">AppleScript</option>
                <option value="apt_sources">Apt sources</option>
                <option value="asm">ASM</option>
                <option value="asp">ASP</option>
                <option value="autoit">AutoIt</option>
                <option value="avisynth">AviSynth</option>
                <option value="bash">Bash</option>
                <option value="basic4gl">Basic4GL</option>
                <option value="bf">Brainfuck</option>
                <option value="blitzbasic">BlitzBasic</option>
                <option value="bnf">bnf</option>
                <option value="boo">Boo</option>
                <option value="c">C</option>
                <option value="c_mac">C (Mac)</option>
                <option value="caddcl">CAD DCL</option>
                <option value="cadlisp">CAD Lisp</option>
                <option value="cfdg">CFDG</option>
                <option value="cfm">ColdFusion</option>
                <option value="cil">CIL</option>
                <option value="cobol">COBOL</option>
                <option value="dcs">DCS</option>
                <option value="cpp">C++</option>
                <option value="cpp-qt" class="sublang">C++ (QT)</option>
                <option value="csharp">C#</option>
                <option value="css">CSS</option>
                <option value="d">D</option>
                <option value="delphi">Delphi</option>
                <option value="diff">Diff</option>
                <option value="div">DIV</option>
                <option value="dos">DOS</option>
                <option value="dot">dot</option>
                <option value="eiffel">Eiffel</option>
                <option value="email">eMail (mbox)</option>
                <option value="fortran">Fortran</option>
                <option value="freebasic">FreeBasic</option>
                <option value="genero">genero</option>
                <option value="gettext">GNU Gettext</option>
                <option value="glsl">glSlang</option>
                <option value="gml">GML</option>
                <option value="gnuplot">Gnuplot</option>
                <option value="groovy">Groovy</option>
                <option value="haskell">Haskell</option>
                <option value="hq9plus">HQ9+</option>
                <option value="html4strict">HTML 4</option>
                <option value="idl">Uno Idl</option>
                <option value="ini">INI</option>
                <option value="inno">Inno</option>
                <option value="intercal">INTERCAL</option>
                <option value="io">Io</option>
                <option value="java">Java</option>
                <option value="java5">Java(TM) 2 SE 5.0</option>
                <option value="javascript">Javascript</option>
                <option value="kixtart">KiXtart</option>
                <option value="klonec">KLone C</option>
                <option value="klonecpp">KLone C++</option>
                <option value="latex">LaTeX</option>
                <option value="lisp">Lisp</option>
                <option value="locobasic">Locomotive Basic</option>
                <option value="lolcode">LOLcode</option>
                <option value="lotusformulas">Lotus Notes @Formulas</option>
                <option value="lotusscript">LotusScript</option>
                <option value="lscript">LScript</option>
                <option value="lsl2">LSL2</option>
                <option value="lua">Lua</option>
                <option value="m68k">Motorola 68000 Assembler</option>
                <option value="make">GNU make</option>
                <option value="matlab">Matlab M</option>
                <option value="mirc">mIRC Scripting</option>
                <option value="modula3">Modula-3</option>
                <option value="mpasm">Microchip Assembler</option>
                <option value="mxml">MXML</option>
                <option value="mysql">MySQL</option>
                <option value="nsis">NSIS</option>
                <option value="oberon2">Oberon-2</option>
                <option value="objc">Objective-C</option>
                <option value="ocaml">OCaml</option>
                <option value="ocaml-brief" class="sublang">OCaml (brief)</option>
                <option value="oobas">OpenOffice.org Basic</option>
                <option value="oracle11">Oracle 11 SQL</option>
                <option value="oracle8">Oracle 8 SQL</option>
                <option value="pascal">Pascal</option>
                <option value="per">per</option>
                <option value="perl">Perl</option>
                <option value="php">PHP</option>
                <option value="php-brief" class="sublang">PHP (brief)</option>
                <option value="pic16">PIC16</option>
                <option value="pixelbender">Pixel Bender 1.0</option>
                <option value="plsql">PL/SQL</option>
                <option value="povray">POVRAY</option>
                <option value="powershell">posh</option>
                <option value="progress">Progress</option>
                <option value="prolog">Prolog</option>
                <option value="providex">ProvideX</option>
                <option value="python">Python</option>
                <option value="qbasic">QBasic/QuickBASIC</option>
                <option value="rails">Rails</option>
                <option value="rebol">Rebol</option>
                <option value="reg">Microsoft Registry</option>
                <option value="robots">robots.txt</option>
                <option value="ruby">Ruby</option>
                <option value="sas">SAS</option>
                <option value="scala">Scala</option>
                <option value="scheme">Scheme</option>
                <option value="scilab">SciLab</option>
                <option value="sdlbasic">sdlBasic</option>
                <option value="smalltalk">Smalltalk</option>
                <option value="smarty">Smarty</option>
                <option value="sql">SQL</option>
                <option value="tcl">TCL</option>
                <option value="teraterm">Tera Term Macro</option>
                <option value="text">Text</option>
                <option value="thinbasic">thinBasic</option>
                <option value="tsql">T-SQL</option>
                <option value="typoscript">TypoScript</option>
                <option value="vb">Visual Basic</option>
                <option value="vbnet">VB.NET</option>
                <option value="verilog">Verilog</option>
                <option value="vhdl">VHDL</option>
                <option value="vim">Vim Script</option>
                <option value="visualfoxpro">Visual Fox Pro</option>
                <option value="visualprolog">Visual Prolog</option>
                <option value="whitespace">Whitespace</option>
                <option value="whois">Whois Response</option>
                <option value="winbatch">Winbatch</option>
                <option value="xml">XML</option>
                <option value="xorg_conf">Xorg configuration</option>
                <option value="xpp">X++</option>
                <option value="z80">ZiLOG Z80 Assembler</option>
		  </select>
Done you have a syntax and select the language from the dropbox ;)
Mizpah
Registered User
Posts: 79
Joined: Tue Apr 25, 2006 1:23 pm

Re: Syntax Highlighter

Post by Mizpah »

Hi Folks,

Latest version installed on a test board, how would I go about changing the default height (i.e, number of lines) for all code boxes ?

At the moment you can see around 5 lines, and can scroll, I would like to change the number of lines seen prior to expand etc.

Regards,

Martin
Mizpah
Registered User
Posts: 79
Joined: Tue Apr 25, 2006 1:23 pm

Re: Syntax Highlighter

Post by Mizpah »

Another issue - however I am unsure if the issue is to do with the mod - or with phpBB3!

I am using rokBridge to sync J! and phpBB3. It usally works without an issue -

However when a post is made with the a syntax highlighter code box in, it errors.

I have discovered that if I visit the page in question via the non bridged url its fine:

http://www.enigmaguild.org/distribution ... hp?f=2&t=2

However when I then use the forum url I have issues:

http://www.enigmaguild.org/forum/viewtopic.php?f=2&t=2

'Fatal error: Call to undefined method stdClass::parse() in /data01/natures/public_html/distribution/includes/hooks/hook_syntax_highlighter.php on line 1274'

All posts without syntax highlighter are fine!

Any brainwaves ?

Cheers,

Miz






http://www.rockettheme.com/forum/index. ... =viewtopic
Locked

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