How can I best display code examples on my site? I'm doing some PHP code examples for a class in a fancy Drupal site.

I have a "Code" content type.
I have a "field_php" that gets processed on the actual node.
I have a view that uses "node/%/code" to display the code formatted via Geshi:  


View PHP Body: Link back to node/1  
View PHP footer: PHP code to pull geshi formatted "field_php"  

&lt;?php 
  include_once('sites/all/libraries/geshi/geshi.php');

  $page = $view-&gt;args[0];
  $node = menu_get_item("node/$page");

  $source = $node['page_arguments'][0]-&gt;field_php['und'][0]['value'];
  $language = 'php';
  $geshi = new GeSHi($source, $language);

  echo $geshi-&gt;parse_code();
?&gt;



LASTLY I have a node--code.tpl.php edited to include a "View Code" link at the top of each "code" page. The include_once/echo at the top is the following:

&lt;div class="&lt;?php print $classes; ?&gt; clearfix"&lt;?php print $attributes; ?&gt;&gt;
  &lt;?php 
    include_once('sites/wernercd.php/public/~functions.php');
    echo "&lt;a href=\"" . curPageURL() . "/code\"&gt;Code For You!&lt;/a&gt;";
  ?&gt;
  &lt;?php if (!$label_hidden) : ?&gt;
    &lt;div class="field-label"&lt;?php print $title_attributes; ?&gt;&gt;&lt;?php print $label ?&gt;:&amp;nbsp;
    &lt;/div&gt;
  &lt;?php endif; ?&gt;
  &lt;div class="field-items"&lt;?php print $content_attributes; ?&gt;&gt;
    &lt;div class="field-item even"&lt;?php print $item_attributes[0]; ?&gt;&gt;&lt;?php print render($items[0]); ?&gt;&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;


http://mysite.com/node/1


http://mysite.com/node/1/code


I don't know why, but I feel like I'm doing it wrong. It works like I want it, but I just feel like its the "wrong" way to go about doing it. 

What would the "recommended" way of getting this desired output be? How could I change this to catch issues unforseen by my naivete?
I would set up an input format for code and set the field_php to use that. The code input format could use a filter like this http://drupal.org/project/codefilter