4

hi :) (sorry if my english is not perfect :/ ) im trying to make a code editor for my site, i want to color automatically code written by users at the some time they tape it. i found this php script which use GeSHi to color code . my problem is that i can't use it in textarea :/ someone talked about using fieldset but i cant understand how :/

include("geshi/geshi.php");

$source = $req;
$language = 'php';
$path = 'geshi/geshi/';

$geshi = new GeSHi($source, $language, $path);

echo $geshi->parse_code();

could someone help me ? :) thank you :)

user3375448
  • 695
  • 6
  • 14
  • You can't do this with GeSHi because it doesn't offer editing capabilities, it only syntax-highlights your markup. Take a look at [CodeMirror](http://codemirror.net/) instead – nice ass Apr 01 '14 at 00:59
  • thank you @onetrickpony :) im going to take a look :) – user3375448 Apr 01 '14 at 01:12
  • 1
    Geshi parse the code server side. You should be parse it using client side so the user can edit the code live. Take a look at http://ace.c9.io for example or http://en.wikipedia.org/wiki/Comparison_of_JavaScript-based_source_code_editors for looking at all of them. ACE is Canvas based and you should strive for that for better performance. – Alon Carmel Apr 02 '14 at 07:26

1 Answers1

1

Geshi can't do that since it run on server side. You may use a JS code highlighter like CodeMirror or highlight.js which run on client side.

felixyadomi
  • 3,197
  • 1
  • 22
  • 28