Jump to content

Syntax highlighter


eevan79

Recommended Posts

I dont know how to solve this. I installed syntax highlight script for my forum script. And its working, but when I write some code I get following:

    function highlight_search($search_words,$string,$bgcolors='yellow')
<br>    {
<br>        if (is_array($bgcolors)) {
<br>            $no_colors=count($bgcolors);
<br>        } else {
<br>            $temp=$bgcolors;
<br>            unset($bgcolors);
<br>            $bgcolors[0]=$temp;
<br>            $no_colors=1;
<br>        }
<br>        $word_no=0;

This is example code and you can see <br> at every line.

Here is used bbcode:

function BBCode ($text) {
$search = array(
'/\[php\](.*?)\[\/php\]/is'};

and replace:

$replace = array(
'<pre class="brush: php;">$1</pre>');

 

How to remove this <br> at every line?

 

Here is screenshot:

00020xo.jpg

Link to comment
https://forums.phpfreaks.com/topic/209570-syntax-highlighter/
Share on other sites

I get this for function callback:

Parse error:  syntax error, unexpected T_VARIABLE

 

What syntax highlighter are you using? I've used GeSHi, and had no problems with that.

I am using this:

http://alexgorbatchev.com/SyntaxHighlighter/download/

 

Link to comment
https://forums.phpfreaks.com/topic/209570-syntax-highlighter/#findComment-1094472
Share on other sites

Again cant edit post :( . Sry.

I found why I get this <br> . Before text is inserted into database I use some BBCode parser and this code:

$text = str_replace("\n", "<br>", $text);

Without this code I dont have new lines, but also it disaplay <br>'s in

[php ] tags.
I think I need to remove all <br>'s here (when parsing bbcodes):
<pre class="brush: php;">$1</pre>

[/code]

Link to comment
https://forums.phpfreaks.com/topic/209570-syntax-highlighter/#findComment-1094473
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.