note 32301 rejected from function.highlight-string by didou
| From: | didou@php.net | Date: | Fri, 23 May 2003 08:23:12 +0000 |
| Subject: | note 32301 rejected from function.highlight-string by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-48863@lists.php.net to get a copy of this message | ||
Note Submitter: michael@scriptmaster.nl
----
[qoute]This is my way to highlight a string...
If you got a big string with some pieces of php-code in it, it leaves all your text as it is made up
with your stylesheets or whatever except for the php code. So it doesn't put your normal text
between those <code></code> tags.
NOTE: you'll have to put your php-code between [php][/php] tags if you want to use this
function.
function phpHighlight($input)
{
$text = spliti("\[php\]|\[\/php\]",$input);
for($i = 0; $i < count($text); $i++) {
if(ereg("(<\?php)(.*)(\?>)",$text[$i])) {
ob_start();
highlight_string($text[$i]);
$text[$i] = ob_get_contents();
ob_end_clean();
}
else {
$text[$i] = nl2br(htmlspecialchars($text[$i]));
}
}
$text = implode("",$text);
return $text;
}
Hope this saves someone some work... ;-)
Robert.
[/qoute]
i try dis but by me he make from dis:
<?php
$ditiseenvariable = ("Ditisdeinhoud");
?>
dis:
ditiseenvariable = ("Ditisdeinhoud");
?>
he hightligh is good
when i try to doe dis :
[php]
<?php
$ditiseenvariable = ("Ditisdeinhoud");
?>[/php]
then he put nothing in the screen
i hope same one can help me
michael