Geshi Highlight Script

Gestart doorJosnl7 reacties26 weergaven

8 berichten · pagina 1 van 1

Josnl

Lid · Topicstarter

Berichten
3.461
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Heey allemaal!

Ik wilde even kijken hoe ik mijn (php) scripts op internet kon highlighten, en toen vond ik het Geshi Highlighter script.

Het enige probleem is dat ik niet weet hoe ik m werkend krijg...

De class is 4755 regels lang, dus die post ik maar niet, maar je kan m hier downloaden:
http://sourceforge.net/projects/geshi/files/geshi/GeSHi%201.0.8.9/GeSHi-1.0.8.9.zip/download

Ik probeer m nu zo aan te roepen in test.php:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Geshi Test</title>
</head>

<body>

[COLOR= #0000BB]<?php[/COLOR]
    
    [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"geshi.php"[/COLOR][COLOR= #007700]);[/COLOR]

    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]<?php echo"Hahahahahahah, nuubs"; ?>[/COLOR][COLOR= #007700];[/COLOR]
    
    [URL="http://www.php.net/echo"]echo[/URL] geshi_highlight[COLOR= #007700]([/COLOR][COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]

?>

</body>
</html>


Maar dan krijg ik deze error:

Quote:
Warning: Missing argument 2 for geshi_highlight(), called in /home/onehosted/domains/onehosted.nl/public_html/test.php on line 16 and defined in /home/onehosted/domains/onehosted.nl/public_html/geshi.php on line 4738

Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/onehosted/domains/onehosted.nl/public_html/geshi.php on line 2020

Warning: Invalid argument supplied for foreach() in /home/onehosted/domains/onehosted.nl/public_html/geshi.php on line 2020

Warning: Invalid argument supplied for foreach() in /home/onehosted/domains/onehosted.nl/public_html/geshi.php on line 2392

Warning: implode() [function.implode]: Argument must be an array in /home/onehosted/domains/onehosted.nl/public_html/geshi.php on line 3345

Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/onehosted/domains/onehosted.nl/public_html/geshi.php on line 3368

Warning: Invalid argument supplied for foreach() in /home/onehosted/domains/onehosted.nl/public_html/geshi.php on line 3368

Warning: Invalid argument supplied for foreach() in /home/onehosted/domains/onehosted.nl/public_html/geshi.php on line 3409

Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/onehosted/domains/onehosted.nl/public_html/geshi.php on line 3461

Warning: Invalid argument supplied for foreach() in /home/onehosted/domains/onehosted.nl/public_html/geshi.php on line 3461

Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/onehosted/domains/onehosted.nl/public_html/geshi.php on line 3606

Warning: Invalid argument supplied for foreach() in /home/onehosted/domains/onehosted.nl/public_html/geshi.php on line 3606

Ik hoop dat iemand me kan helpen!

Gr. Jos
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Je kunt toch ook gewoon de php functie highlight_string(); gebruiken?
0
Josnl

Lid · Topicstarter

Berichten
3.461
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nee, die is niet mooi. En ik wil graag ook dat ie van andere talen gedeeltes highlight.biggrin
0
Berichten
3.283
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jos, je zegt

"De class is 4755 regels lang,...."

en je gebruikt een functie in je script?

edit: foutje;

probeer dit:
geshi_highlight($string, PHP);
0
Josnl

Lid · Topicstarter

Berichten
3.461
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ja klopt, maar hoe moet ik dan aanroepen dat ie hem highlight?
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Hoe had je het opgelost

(Handig voor de andereyummie)
0
Josnl

Lid · Topicstarter

Berichten
3.461
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Was vergeten de map geshi te uploaden, vervolgens deze code gebruikt:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Highlight</title>
</head>

<body>

[COLOR= #0000BB]<?php[/COLOR]

[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"geshi.php"[/COLOR][COLOR= #007700]);[/COLOR]


[COLOR= #0000BB]$source[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]<?php $foo = 45;
for ( $i = 1; $i < $foo; $i++ )
{
  echo "$foon";
  --$foo;
}?>[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$language[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]php[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$path[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]geshi[/COLOR][COLOR= #007700];[/COLOR]

[COLOR= #0000BB]$geshi[/COLOR] [COLOR= #007700]= new[/COLOR] GeSHi[COLOR= #007700]([/COLOR][COLOR= #0000BB]$source[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$language[/COLOR][COLOR= #007700]);[/COLOR]
 
[COLOR= #0000BB]$geshi[/COLOR][COLOR= #007700]->[/COLOR]enable_line_numbers[COLOR= #007700]([/COLOR]GESHI_FANCY_LINE_NUMBERS[COLOR= #007700]);[/COLOR]
geshi_highlight[COLOR= #007700]([/COLOR][COLOR= #0000BB]$source[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]php[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$path[/COLOR][COLOR= #007700],[/COLOR] true[COLOR= #007700]);[/COLOR]

[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$geshi[/COLOR][COLOR= #007700]->[/COLOR]parse_code[COLOR= #007700]();[/COLOR] 



?> 

</body>
</html
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren