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. Quote Link to comment 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... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.