Uutiset:

Wondering if this will always be free?  See why free is better.

Main Menu
Advertisement:

PHP highlighting in [code]

Aloittaja mikechml, huhtikuu 27, 2006, 06:26:24 IP

« edellinen - seuraava »

mikechml

The [code] tag currently only highlights PHP code if it begins with "<?php", could it be changed to allow "<?" also?

jerm

you can use the
[php] [/php]
bbcode


echo 'bla';


^^as an example

Oldiesmann

Hmmm... Try this

Sources/Subs.php

1.0.x:

Find
$php_parts = preg_split('~(&lt;\?php|\?&gt;)~', $parts[$i], -1, PREG_SPLIT_DELIM_CAPTURE);

Replace
$php_parts = preg_split('~((&lt;\?php|&lt;\?)|\?&gt;)~', $parts[$i], -1, PREG_SPLIT_DELIM_CAPTURE);

Find
// Do PHP code coloring?
if ($php_parts[$php_i] != '&lt;?php')


Replace
// Do PHP code coloring?
if ($php_parts[$php_i] != '&lt;?php' && $php_parts[$php_i] != '&lt;?')


1.1:

Find
$php_parts = preg_split(\'~(&lt;\?php|\?&gt;)~\', $data, -1, PREG_SPLIT_DELIM_CAPTURE);

Replace
$php_parts = preg_split(\'~((&lt;\?php|&lt;\?)|\?&gt;)~\', $data, -1, PREG_SPLIT_DELIM_CAPTURE);

Find (twice)
// Do PHP code coloring?
if ($php_parts[$php_i] != \'&lt;?php\')


Replace (twice)
// Do PHP code coloring?
if ($php_parts[$php_i] != \'&lt;?php\' && $php_parts[$php_i] != \'&lt;?\')
Michael Eshom
Christian Metal Fans

Advertisement: