yes i love technology

Sytax highlighting A-go-go

January 26th, 2007 by Pete

Theres only one thing that I love more than technology and thats code!

I've added the IG: Syntax Higliter plugin to this blog so I can start publishing snippets of code on this blog. The plugin can support php, html, sql, and a whole host of others languages click here to find out more about it.

Below is a fascinating piece of PHP I cranked out to check its working.

PHP:
  1. // completely useless example of some PHP code
  2. $arr = array('Pete', 'is', 'the', 'best!');
  3.  
  4. $html = '';
  5.  
  6. /*
  7. everybody loves a good foreach loop
  8. */
  9. foreach($arr as $key => $value)
  10. {
  11. $html .= $value.' ';
  12. }
  13.  
  14. $html = rtrim($html);
  15. echo $html;
  16. # wow this is great
  17.  
  18. ?>

My only complaint I have about the plugin is it doesn't seem to provide any indentation when it displays the code, even if you paste the code into wordpress nicely indented. Maybe there's a setting to activate this. If anyone can tell me where it is I'll buy them a beer, if you don't drink beer then you can watch me drink two instead.

// Pete Graham

Posted in Tech, Pete Graham, syntax highlighting, code, plugins | 6 Comments »