Date: Sat, 2 Aug 2008 14:15:24 +0000
Mime-Version: 1.0 (Produced by PhpWiki 1.3.14-20080124)
X-Rcs-Id: $Id$
Content-Type: application/x-phpwiki;
pagename=Help%2FPhpHighlightPlugin;
flags=PAGE_LOCKED;
markup=2;
charset=iso-8859-1
Content-Transfer-Encoding: binary
The *~PhpHighlight* plugin pretty-prints PHP code using the
php-function:highlight-string.
See also [SyntaxHighlighter|Help:SyntaxHighlighterPlugin] plugin for highlighting other languages.
!!! Usage
You specify options for the plugin on the same line as the ==:
!!! Description
Depending on the =wrap= option, then the plugin will take care of
adding == to the code before passing it to
php-function:highlight-string. If the PHP delimiters were added, then
the plugin removes them again from the highlighted string, before
presenting it.
!!! Options
Automatic Wrapping:
If you don't want the plugin to automatically wrap the source code
in ==, then set =wrap= to =0=. The default value is =1=
which means that the plugin takes care of adding and removing
== automatically.
If you set =wrap= to =0=, then you'll be able to mix PHP code with
HTML. The plugin will then translate '=< ?php=' into '==' into '=?>=' to allow you to start and stop PHP mode in your
code.
Color Options:
The plugin accepts optional color arguments which correspond to the
highlight settings in *php.ini*. Specified colors must be a valid
hexadecimal color or
[HTML 4 color name|http://www.w3.org/TR/REC-html40/types.html#h-6.5]
in lowercase, such as ='#0f0344'= or =blue=. You can set the
following options:
=string=, =comment=, =keyword=, =bg=, =default=, and =html=
!!! Examples
!! PHP with default colors from =php.ini=:
";
}
?>
!! HTML with embedded PHP
Here we have to use =wrap=0= to prevent automatic wrapping, and escape
'=?>=' as '=? >=':
PHP Test
< ?php echo "Hello World
\n"; ? >