Warning: Undefined variable $g_imageViewer in C:\Users\Momin\sanestudios\gitroot\projects\Site\header.sg on line 81

N2 PHP Support

N2 supports syntax highlighting of PHP scripts. It can automatically switch between PHP, HTML an JavaScript in the same source file.

Setup

Setting up PHP support is simple. It requires adding a few lines to your n2.ini configuration file. If you already have an n2.ini file, open it for editing. This file is normally located in your Documents (or My Documents) directory. Now add the following lines: (you can also download this file from here)

[Engine_JS]
Extensions=js
Keywords=break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public null true false
CaseSensitive=1
CommentStart=//
LongCommentStart=/*
LongCommentEnd=*/

[Engine_PHPBase]
Extensions=phps
Keywords=and or xor __FILE__ exception __LINE__ array as break case class const continue declare default die do echo else elseif empty enddeclare endfor endforeach endif endswitch endwhile eval exit extends for foreach function global if include include_once isset list new print require require_once return static switch unset use var while __FUNCTION__ __CLASS__ __METHOD__ final php_user_filter interface implements extends public private protected abstract clone try catch throw cfunction
CaseSensitive=1
CommentStart=//
LongCommentStart=/*
LongCommentEnd=*/

[Engine_PHP]
Extensions=php
TreatAs=html

Now save n2.ini and restart n2.

When you open a PHP file, the syntax highlighting should work for mixed PHP, HTML and JavaScript content. For example: