Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 27th, 2009  |  syntax: PHP  |  size: 0.48 KB  |  hits: 98  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. /**
  3.  * Defines the SongHolder page type
  4.  */
  5. class SongHolder extends Page {
  6.    static $db = array(
  7.    );
  8.    static $has_one = array(
  9.    );
  10.    
  11.    static $allowed_children = array('SongDetailPage');
  12. }
  13.  
  14. class SongHolder_Controller extends Page_Controller
  15. {
  16.        
  17.         function song()
  18.         {
  19.                 static $song = null;
  20.                
  21.                 if(!$song)
  22.                 {
  23.                         if($id = (int) Director::urlParam('ID'))
  24.                         {
  25.                           $song = DataObject::get_by_id("Song", $id);
  26.                         }
  27.                 }
  28.                
  29.                 return $song;
  30.         }
  31. }
  32. ?>