ok i know i started my own syntax highlighting project before. but i wanted to try and use the built in php syntax highlighter
for experimental purposes.
any ideas why isnt this working.
its an attempt to use php built in highlighter.
but the resulting source code come back like this when displayed..
basically just turning all text black.
so its finding the string of code. adding the code tag and only 1 span style color.
i was wondering if it would possibly have something to do with the htmlentities i set on the string before adding it to database.
then use this function to pull the string from the database then try to highlight it.
for experimental purposes.
any ideas why isnt this working.
PHP Code:
/** Show Post */
function Show_Post($Posts_To_Show, $File_Path)
{
$Show_Posts = file($File_Path);
for($k = 0; $k<$Posts_To_Show; $k++)
{
echo preg_replace('/<div class="codebox">(.*?)<\/div>/i', '<div class="codebox">'.highlight_string('\\1', true).'</div>', $Show_Posts[$k]);
}
} /** End Of Show Post Function */
//
//
//
but the resulting source code come back like this when displayed..
PHP Code:
<div class="codebox"><code><span style="color: #000000">
/** Show Post */
function Show_Post($Posts_To_Show, $File_Path)
{
$Show_Posts = file($File_Path);
for($k = 0; $k<$Posts_To_Show; $k++)
{
echo preg_replace('/<div class="codebox">(.*?)<\/div>/i', '<div class="codebox">'.highlight_string('\\1', true).'</div>', $Show_Posts[$k]);
}
} /** End Of Show Post Function */
</span></code></div>
//
//
//
//
so its finding the string of code. adding the code tag and only 1 span style color.
i was wondering if it would possibly have something to do with the htmlentities i set on the string before adding it to database.
then use this function to pull the string from the database then try to highlight it.
Comment