IranDelphi
05-11-2008, 10:54 AM
hi
our forum is about delphi programming.we wan that when a user enteres a text in [code] or [delphi] tag ([delphi] is our custom tag,but if possible) , shows the text in this tag in syntax highlighter like delphi(like [php] tag).
we found two php code for parse some text in programming language syntax for example delphi or java syntax(you can see a sample in this link:
http://www.f-in-box.org/delphi/
)
----------------------------------------
we should do this with 2 different way.
1-with geshi syntax highlighter:
include_once('geshi.php');
$source ="some text for syntax highlighting";
$geshi = new GeSHi($source, 'delphi');
echo $geshi->parse_code();
and the variant $source is the text that goes to be highlight.
-----------------------------
2-with dp.SyntaxHighlighter
we should use this line for highlight some text :
<LINK href="SyntaxHighlighter.css" type=text/css rel=stylesheet>
<SCRIPT language=javascript src="shCore.js"></SCRIPT>
<SCRIPT language=javascript src="shBrushDelphi.js"></SCRIPT>
<SCRIPT language="javascript">
dp.SyntaxHighlighter.ClipboardSwf = 'SyntaxHighlighter/Scripts/clipboard.swf';
dp.SyntaxHighlighter.HighlightAll('code');
</script>
and use <pre> tag like :
<PRE class=delphi name="code"> ..... </pre>
and then the last line :
<SCRIPT language=javascript src="shInit.js"></SCRIPT>
-------------------------------
please help me how can i do yhis.
Waitnig for your kind reply very soon.
Best Regards
Babak Ahadi
--------------- Added 1210510997 at 1210510997 ---------------
hi
tnx 2 all.
i solved it.
Be fun!!!!!
our forum is about delphi programming.we wan that when a user enteres a text in [code] or [delphi] tag ([delphi] is our custom tag,but if possible) , shows the text in this tag in syntax highlighter like delphi(like [php] tag).
we found two php code for parse some text in programming language syntax for example delphi or java syntax(you can see a sample in this link:
http://www.f-in-box.org/delphi/
)
----------------------------------------
we should do this with 2 different way.
1-with geshi syntax highlighter:
include_once('geshi.php');
$source ="some text for syntax highlighting";
$geshi = new GeSHi($source, 'delphi');
echo $geshi->parse_code();
and the variant $source is the text that goes to be highlight.
-----------------------------
2-with dp.SyntaxHighlighter
we should use this line for highlight some text :
<LINK href="SyntaxHighlighter.css" type=text/css rel=stylesheet>
<SCRIPT language=javascript src="shCore.js"></SCRIPT>
<SCRIPT language=javascript src="shBrushDelphi.js"></SCRIPT>
<SCRIPT language="javascript">
dp.SyntaxHighlighter.ClipboardSwf = 'SyntaxHighlighter/Scripts/clipboard.swf';
dp.SyntaxHighlighter.HighlightAll('code');
</script>
and use <pre> tag like :
<PRE class=delphi name="code"> ..... </pre>
and then the last line :
<SCRIPT language=javascript src="shInit.js"></SCRIPT>
-------------------------------
please help me how can i do yhis.
Waitnig for your kind reply very soon.
Best Regards
Babak Ahadi
--------------- Added 1210510997 at 1210510997 ---------------
hi
tnx 2 all.
i solved it.
Be fun!!!!!