emcgfx Posted June 15, 2009 Share Posted June 15, 2009 Hey guys, I'm trying to figure out on how to add line numbers and odd/even colors to my code. Please help. <?php // // Include the GeSHi library// include_once 'geshi/geshi.php'; //// Define some source to highlight, a language to use // and the path to the language files// $source = '$foo = 45; for ( $i = 1; $i < $foo; $i++ ){ echo "$foo\n"; --$foo; }'; $language = 'php'; // Create a GeSHi object// $geshi = new GeSHi($source, $language); $geshi->start_line_numbers_at(1); $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS); $geshi->set_line_style('background: #fcfcfc;', 'background: #f0f0f0;'); // And echo the result!// echo $geshi->parse_code(); ?> As you can see I've defined this lines to enable this function. But still not working. Yes geshi.php and needed files included properly, if you are wondering Thanks. Link to comment https://forums.phpfreaks.com/topic/162228-geshi-code-formatter/ Share on other sites More sharing options...
emcgfx Posted June 15, 2009 Author Share Posted June 15, 2009 ok looks like it works properly when I use it directly. http://localhost/www/site/test.php but when I use it to include from my include menu, http://localhost/www/site/index.php?p=test (with proper include directory of course) its not working... Link to comment https://forums.phpfreaks.com/topic/162228-geshi-code-formatter/#findComment-856178 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.