NYCPHP Meetup

NYPHP.org

[nycphp-talk] Accessing Properties in PHP OOP

Joseph Crawford Jr. jcrawford at codebowl.com
Thu Aug 26 09:55:14 EDT 2004


This is what i was going to suggest next :)

Joe Crawford Jr.


----- Original Message ----- 
From: "Scott Mattocks" <scott at crisscott.com>
To: "NYPHP Talk" <talk at lists.nyphp.org>
Sent: Thursday, August 26, 2004 9:37 AM
Subject: Re: [nycphp-talk] Accessing Properties in PHP OOP


> You need to make display and validator a member of the client class. 
> Then you client class would look like this.
> 
> class Client {
>      var $display;
>      var $validator;
>      var $conn;
>      var $clientNameEM;
>      var $clientName;
> 
>      function Client() {
>          $this->display   =& new Display;
> $this->validator =& new Validator;
> $this->conn      =& new Conn; //Don't know where this comes from.
>      }
> 
>      function clientNameCheck($value){
> 
>          $test = $this->validator->validateMixed($value);
>          if(!$test){
>              $this->display->errors = true;
>              $this->clientNameEM = '<p class="error">ERROR: Client name 
> is not valid.</p>';
>              return false;
>              }
>          }
>      //begin add method
>      function addClient(){
> 
>          //validate user input
> 
>          $this->clientNameCheck($this->clientName);
>          }
>      //end add method
>      }
> 
> Scott Mattocks
> _______________________________________________
> New York PHP Talk
> Supporting AMP Technology (Apache/MySQL/PHP)
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.newyorkphp.org
> 
> 



More information about the talk mailing list