Page 1 of 1

Is there a tutorial one how to color the fonts?

Posted: Sat Jul 29, 2006 7:54 pm
by Erfangc
Is there any kind of online tutorial (I googled it with no luck) that will teach me how to create something similar to the effect of the [code ) tag?

Posted: Sat Jul 29, 2006 8:17 pm
by jamiel
I'd assume it's just regular expressions.

Posted: Sat Jul 29, 2006 8:18 pm
by feyd
The

Code: Select all

tags only do one color: green. Maybe you're more referring to the

Code: Select all

or [syntax] tags? They are powered by [url=http://qbnz.com/highlighter/]Geshi[/url].

the

Code: Select all

tags are basically a glorified <pre> tag with some style settings on the font's color via CSS.

Posted: Sat Jul 29, 2006 8:43 pm
by Erfangc
besides the default documentation. Is there a comprehensive tutorial on GeShi?

Posted: Sat Jul 29, 2006 8:51 pm
by feyd
If you're looking to color php code only, you could use php's internal coloring controls: highlight_string() and highlight_file()

As for a tutorial on Geshi, I have not looked for one, so I don't know.

Posted: Sat Jul 29, 2006 9:01 pm
by Erfangc
thanks for the reply.
After reading the documentation on GeSHi I believe it is unnecessary for any additional tutorials.

Posted: Sat Jul 29, 2006 9:46 pm
by Erfangc
strange, the following code caused the $source to be outputed first.

Code: Select all

$row = mysql_fetch_array($results);
$content = $row['content'];
$title = $row['title'];
echo "<tr><td><p><font size='+6'>".$title."</font></p></td></tr> ";
echo str_replace("\t", '&nbsp;&nbsp;', nl2br("<tr id='content_area'><td>".$content."</td></tr>"));
$source =
"//source";
$lan = 'java5';
			
$geshi =& new GeSHi($source, $lan);
			
$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
echo $geshi->parse_code();