At 3:47 PM +0530 2/26/01, Harshdeep S Jawanda wrote:
>Hello everybody,
>
>I am a newbie, so please help me out with my rather basic question.
>
>Please take a look at the following code snippet:
>
>   class HTMLTable extends HTMLElement {
>     var $attributes;
>
>     function HTMLTable() {
>       $attributes[] = array("border", "0");
>       $attributes[] = array("cellpadding", "0");
>       // and some other things
>     }
>
>     function emit() {
>       // I get an error on this line
>       $arrLength = count($this->attributes[1]);
>     }
>   }
>
>On the line indicated above, I get the error: "Warning: Undefined
>property: attributes in html_base_classes.inc on line <line-number>"
>
>Can anybody give me a clue as to why this is happening?


In your HTMLTable() function, use

        $this->attributes[] = array("border", "0");
        $this->attributes[] = array("cellpadding", "0");

otherwise, PHP thinks $attributes is a variable local to that 
function, rather that a class variable.

        -steve


>--
>Regards,
>Harshdeep Singh Jawanda.
>

-- 
+--- "They've got a cherry pie there, that'll kill ya" ------------------+
| Steve Edberg                           University of California, Davis |
| [EMAIL PROTECTED]                               Computer Consultant |
| http://aesric.ucdavis.edu/                  http://pgfsun.ucdavis.edu/ |
+-------------------------------------- FBI Special Agent Dale Cooper ---+

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to