Weber Sites LTD wrote:
I was afraid of that...
I need to do HTML manipulations on the text that is outside the <??>.
After I run highlight_string the original text is messed up.
If I run the manipulations before then they will look like HTML
And not act as HTML...
Any ideas?
You could get the php from your page, highlight it and replace it back in:
preg_replace('%<?(.*)?>%s', 'highlight_string(${1})', $content);
don't know if that will work straight out for you but that should give
you an idea on how to proceed.
Or you could temporarily remove them, do whatever then replace it back in:
$placeholders = array();
while(preg_match('%<?(.*)?>%s', $content, $matches)) {
$size = sizeof($placeholders);
$placeholders[$size] = $matches[1];
$content = str_replace($matches[0], '%%PLACEHOLDER['.$size.']%%',
$content);
}
... other processing here.
foreach($placeholders as $i => $text) {
$content = str_replace('%%PLACEHOLDER['.$i.']%%',
highlight_string($text), $content);
}
-----Original Message-----
From: chris smith [mailto:dmagick@xxxxxxxxx]
Sent: Monday, March 06, 2006 11:59 AM
To: Weber Sites LTD
Cc: php-general@xxxxxxxxxxxxx
Subject: Re: highlight_string()
On 3/6/06, Weber Sites LTD <berber@xxxxxxxxxxxxxxx> wrote:
The only way I could work around this was to put empty <??> at the
Beginning of the text and now highlight_string() highlights only what
Is inside <? ?>
You can see an example of the problematic text in the example Area of
this page : http://www.weberdev.com/get_example-4345.html
Notice the empty <? ?> at the beginning of the example.
Without them, all of the example, including the text and HTML Part
will be painted by highlight_string().
Is this a bug?
No. It will highlight html as well.
You can give the illusion of it not highlighting the html by using:
ini_set('highlight.html', '#000000');
--
Postgresql & php tutorials
http://www.designmagick.com/
--
Postgresql & php tutorials
http://www.designmagick.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php