froens Posted June 28, 2007 Share Posted June 28, 2007 Hi there. I'm building a site where i'm trying to use the DOMApi supplied with PHP. The basic idea is to make all my bricks as small xml-nodes that can be apprehended by others. The problem is that i'm having problems with defining objects as attributes. I'm a bit rusty with the PHP-syntax so please bear over with me. class Treatmentlist extends DOMNode { private $pDomL; private $pParent; private $pInitialized; public function __construct($aParent) { $pParent = $aParent; $pDom = $aParent->ownerDocument; } .... some other methods ... } The problem is that when I refer to $pDom, it doesn't recognize it as an object of the type DOMDocument. What would solve my problem ? Link to comment https://forums.phpfreaks.com/topic/57628-objects-as-object-attributes/ Share on other sites More sharing options...
no_one Posted June 28, 2007 Share Posted June 28, 2007 Not sure if this will answer your question, but I believe $pParent = $aParent should be $this->pParent = $aParent .. and so on. Also, you say $pDom where the private var is $pDomL .. ? Link to comment https://forums.phpfreaks.com/topic/57628-objects-as-object-attributes/#findComment-285273 Share on other sites More sharing options...
froens Posted June 29, 2007 Author Share Posted June 29, 2007 That would be a typo I guess. The problem is that it doesn't see $pDom as an object. So I can't call on it's methods CreateElement for instance. Link to comment https://forums.phpfreaks.com/topic/57628-objects-as-object-attributes/#findComment-285524 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.