Share Pastebin
Guest
Public paste!

matt

By: a guest | Jan 24th, 2008 | Syntax: None | Size: 1.52 KB | Hits: 36 | Expires: Never
Copy text to clipboard
  1. CLASS
  2.  
  3. ARRAY
  4. has all the fiels in the mySQL table, so we can filter the REQUEST information
  5.  
  6.  
  7.  
  8.         get($what)
  9.     {
  10.         switch templete
  11.        
  12.                 1 - select * from there where this
  13.             2 - select * from there where this and this
  14.            
  15.          query the database
  16.          return the $result from the query
  17.     }
  18.    
  19.     show($what, $template, $name)
  20.     {
  21.         switch template
  22.        
  23.         1--------
  24.         sub headers($name) etc and any DIVS required
  25.         $result = CALL get($what)
  26.         $markup = display($result, $template)
  27.         $markup .= any other markup required, e.g. more div, subheaderEnd etc.
  28.         ---------------------
  29.        
  30.         2--------
  31.         etc etc
  32.         ----------------------
  33.        
  34.         end switch
  35.        
  36.         return $markup
  37.      }
  38.      
  39.      display($template, $result)
  40.      {
  41.          global $db;
  42.          
  43.          SWITCH TEMPLATE
  44.          
  45.                 $out = '';
  46.                 while($obj = mysqli_fetch_object($result))
  47.                 {
  48.                         $out .= $this->rowDesign($obj);
  49.                 }
  50.                 $out .= 'any required markup';
  51.                 return $out;
  52.      
  53.      }
  54.      
  55.      rowDesign($template, $obj)
  56.      {
  57.         SWITCH TEMPLATE
  58.        
  59.         the design for a single entry
  60.         return $rowMarkup
  61.      }
  62.      
  63.      simpleGet($which)
  64.      {
  65.         returns a basic query - returns a $obj or the result, ready to use.
  66.      }
  67.      simpleAdd($_REQUEST)
  68.      {
  69.         add a new entry
  70.      }
  71.      simpleUpdate($_REQUEST, $IDtoUpdate)
  72.      {
  73.         updates an entry
  74.      }