custom highlight code
Discuss coding issues, and scripts related to PHP and MySQL.
-
JanMolendijk
- Posts: 267
- Location: Holland Rotterdam
custom highlight code
Hello Coursesweb I try to update my highlight code from ini_set
but I would also like to color it with string replacements or something else
For the moment only <php + ?> is highlighted +
info code with // enter text is highlighted
The code aply from a text-file into the document.
Code: Select all
<?php
$res = $MySQLiconn->query("SELECT * FROM `userfiles` where code_id='$id' ORDER BY `ID` DESC ");
$count = $res->num_rows;
if($count > 0)
{
while($row=$res->fetch_array())
{
?>
Code: Select all
<?php
ini_set("highlight.comment", "#008000");
ini_set("highlight.default", "#000000");
ini_set("highlight.html", "#808080; font-size: 16px;");
ini_set("highlight.keyword", "#0000BB; font-weight: bold");
ini_set("highlight.string", "#DD0000");
?>
I would like in the output an complete highlighted file as result now it only one part.
Code: Select all
<?php show_source("$row[FilePath]/Files--PHP-HTML-CODE/$row[code_file]/$row[FileName]"); ?>
Here is an example from the result (Only the php code in result is highlighted).
145.53.93.209/Molendijk/Source/upload/Show/Maps/source.php?id=530835
MarPlo
Try with the php highlight_string() function.
More details and examples to the php documentation:
highlight_string
JanMolendijk
I found the answer Thanks for suporting
Code: Select all
<h1 style="font-size:20;">
<?php
ini_set('highlight.html', '"font-size="20px "class="aw_htmlsrc');
$aw_source = highlight_file("$row[FilePath]/Files--PHP-HTML-CODE/$row[code_file]/$row[FileName]", TRUE);
echo str_replace("", "" , $aw_source );
?>
</h1>
Similar Topics
-
Get country code from JavaScript to PHP
PHP - MySQL
First post
Chief I have a problem to get the countrycode into my sql-statement.
Please help me out....
This script is to detect the countrycode...
Last post
The JavaScript code cannot be executed in php.
Javascript is executed in browser, after the php finished to output its data.
Also, Javascript it is...
-
Add id from php variable into javascript code
PHP - MySQL
First post
Dear Coursesweb about mail-function I try another way to complete
Now my problem is to get the referenceid from Url.
<script src=...
Last post
Ow sometimes I`m stupid :D thanks it is working now