PHP Classes

File: includes/class.reaction.php

Recommend this page to a friend!
  Classes of SPAM   pork.dbObject   includes/class.reaction.php   Download  
File: includes/class.reaction.php
Role: Class source
Content type: text/plain
Description: Example class: reaction
Class: pork.dbObject
Map objects into MySQL database table rows
Author: By
Last change:
Date: 17 years ago
Size: 751 bytes
 

Contents

Class file image Download
<?


class Reaction extends dbObject
{
    function
__construct($ID=false)
    {
       
$this->__setupDatabase('reactions', // database table
       
array('ID_Reaction' => 'ID', // database field => mapped object property
           
'ID_Blog' => 'ID_Blog',
           
'strPoster' => 'Poster',
           
'strEmail' => 'Email',
           
'strIp' => 'Ip',
           
'strReaction' => 'Reaction',
           
'datReply' => 'ReplyDate'),
           
'ID_Reaction', // primary table key
           
$ID); // value of primary key to init with (can be false for new empty object / row)
       
$this->addRelation('Blog'); // define a many:many relation to Blog through Reaction
   
}

    function
display()
    {
        return(
"<div><h4>by {$this->Poster} @ {$this->ReplyDate}</h4><div>{$this->Reaction}</div></div>");
    }
}



?>