note 125233 added to misc.configuration
| From: | Eric@php.net | Date: | Thu, 30 Jul 2020 14:45:10 +0000 |
| Subject: | note 125233 added to misc.configuration | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-214915@lists.php.net to get a copy of this message | ||
*** Additions to the previous message ***
To change the style directly from a CSS file, it is recommended to only go through classes instead
of hard-coding it.
<?php
// Create an array with default php functions
$functions = array("default", "html", "keyword",
"string", "comment");
// Replace color code (ex: #FF8000) with class name (ex:"highlight-comment")
foreach ($functions as $value) {
ini_set("highlight.$value", "highlight-$value;");
}
$content = highlight_file($filename, true);
// or
$content = highlight_string($string, true);
// Convert style="color: highlight-function" into class="highlight-function"
into $content
// It allows you to modify only the default functions
foreach ($functions as $value) {
$content = preg_replace("/style=\"color: highlight-$value;\"/",
"class=\"highlight-$value\"", $content);
}
?>
And in the CSS file (for example) :
.highlight-html { color: #000000; }
.highlight-default { color: #0000bb; }
.highlight-keyword { color: #007700; font-weight: bold; }
.highlight-string { color: #dd0000; }
.highlight-comment { color: #ff8000; }
----
Server IP: 45.112.84.4
Probable Submitter: 103.51.166.36 (proxied: 80.215.234.20)
----
Manual Page -- http://php.net/manual/en/misc.configuration.php
Edit -- https://master.php.net/note/edit/125233
Del: integrated -- https://master.php.net/note/delete/125233/integrated
Del: useless -- https://master.php.net/note/delete/125233/useless
Del: bad code -- https://master.php.net/note/delete/125233/bad+code
Del: spam -- https://master.php.net/note/delete/125233/spam
Del: non-english -- https://master.php.net/note/delete/125233/non-english
Del: in docs -- https://master.php.net/note/delete/125233/in+docs
Del: other reasons-- https://master.php.net/note/delete/125233
Reject -- https://master.php.net/note/reject/125233
Search -- https://master.php.net/manage/user-notes.php