Helpful Information
 
 
Category: Forum Announcements
New BBCode - Syntax Highlighter

We have added new bbcode “highlighter” which use for generic syntax highlighting. This one support wide range of popular languages.

Usage :
[ highlight=language ]
Codes
[ /highlight ]

Here is a new highlighter bbcode in action, displaying part of a PHP code.
<?php
function _split_text($text)
{
$MAX_LENGTH = 160;

$split=explode(" ",$text);
$numwords = count($split);
$i=0; //while counter
$a = 1; //counts the text chunks

$amount = ceil(strlen($text)/($MAX_LENGTH-5)); //get total word chunks
while($i < $numwords){
$len = (strlen($newtext[$a])+strlen($split[$i])); //get length of the active chunk
if($len>($MAX_LENGTH-5)){ //do we have to start a new one?
$a++;
$newtext[$a] = "[$a/$amount] "; //Adds [1/2]
}else{
if($i == 0) $newtext[$a] = "[$a/$amount] ";
$newtext[$a]=$newtext[$a]." ".$split[$i];
$i++;
}
}
return $newtext;
}
}
?>


Here is the list of languages supported by this new bbcode

actionscript
ada
apache
asm
asp
bash
caddcl
cadlisp
c_mac
c
cpp
csharp
css-gen.cfg
css
delphi
diff
div
d
eiffel
gml
html4strict
java
javascript
lisp
lua
matlab
mpasm
nsis
objc
oobas
oracle8
pascal
perl
php-brief
php
python
qbasic
smarty
sql
vbnet
vb
vhdl
visualfoxpro
xml

We have add new highlight button http://forums.devshed.com/images/editor/highlight.gif to editor toolbar, so people can easily use that button to create [ highlight=language ] tags.










privacy (GDPR)