|
Posted by Janwillem Borleffs on 10/30/05 14:49
carlton wrote:
> PictureList[] is supposed to be an array of C_PictureList objects,
> not a member of the C_PictureList class.
>
You are defining PictureList in the class, which makes it a class member or
a property at least, regardless of what it contains.
Therefore, you are bounded to some restrictions regarding the syntax. If you
don't want it to be member of the class, but accessible through it, one
option would be to define it as a static variable within a class method:
<?php
class C_PictureList {}
class C_Category {
function accessPictureList($new_value = null) {
static $PictureList = array();
if (is_object($new_value)) {
$PictureList[] = $new_value;
} else {
return $PictureList;
}
}
}
// Set
C_Category::accessPictureList(new C_PictureList);
// Get
print_r(C_Category::accessPictureList());
?>
JW
Navigation:
[Reply to this message]
|