New PHP Highlighter In Town
Posted by Frank on September 18, 2008Hey everyone,
As you could have read here, the current release of my code highlighter has some trouble with highlighting PHP on servers running PHP version 4. I told you I should try to fix the problem and include a better PHP highlighter in the next release.
I worked very hard this morning to get PHP fixed, and I’m proud to announce that PHP is almost working the way it should. That means: including servers running PHP4.
You want an example? Sure, here it is:
PHP Code Like It Should
<?php |
|
/* Connect to a MySQL database using driver invocation */ |
|
$dsn = 'mysql:dbname=testdb;host=127.0.0.1'; |
|
$user = 'dbuser'; |
|
$password = 'dbpass'; |
|
|
|
try { |
|
$conn = new PDO($dsn, $user, $password); |
|
$sql = 'SELECT name, color, calories FROM fruit ORDER BY name'; |
|
|
|
foreach ($conn->query($sql) as $row) { |
|
echo $row['name'] . "\t"; |
|
echo $row['color'] . "\t"; |
|
echo $row['calories'] . "\n"; |
|
} |
|
} catch (PDOException $e) { |
|
echo 'Connection failed: ' . $e->getMessage(); |
|
} |
|
?> |
So, What’s Next?
After this highlighter is finished, I create one for JavaScript and properly one for Java. As soon as they all work the way it should, I will release version 1.1.
See you.
New PHP Highlighter In Town – Frank Verhoeven great article thank you.
yes i tried that line..
none of the types seems working fine but it’s only with this theme.. and i really don’t know why since, as you said, the pre tag isn’t defined..
thanks for your answer!
hello!
thanks for the plugin, it is very nice.. but i have a problem with it in a theme.. the point is not all of the font in the pre tag becomes courier new, some of the text stays unmodified..
is it because of the theme? i tried putting an !important in the stylesheet of the plugin near the font but still nothing..
you can check it here: iBlog
thanks!
So you already tried to add this in the admin (Appearance – Code Highlighter)
It is strange, because in all the stylesheets included in your page, there isn’t styled the pre tag once. Are other code types also not displayed with courier?