Easy to use php syntax highlight module.
- HTML
- CSS
- PHP (with PHP
highlight_string) - JS (with PHP
highlight_string) - HTACCESS
- Modular
- Expandable
Download the latest release, unzip and put it into to your project directory. Then load the module in your .php file with:
require_once('synParser.php')Initialize with:
new synhigh(string $source, string $language, bool $lineNumbers, int $lineBegin, int $lineEnd);$source: string to highlight$language: language namephp, for PHP or JShtml, for HTML and mixed HTML/PHPcsshtaccess
$lineNumbers: whentruesynhigh will append line numbers [optional]$lineBegin: line where the source begins [optional]$lineEnd: line where the source ends [optional]
Functions:
$myVar->parseCode(), returns the output as string$myVar->setWithinLine(true), formats the output for using within a line- Setter:
$myVar->setSource($source)string$myVar->setLang($lang)string$myVar->setLineNumbers($lineNumbers)boolean$myVar->setLineBegin($lineBegin)integer$myVar->setLineEnd($lineEnd)integer
Check the LICENSE file.