Logic I really do appreciate all your input.
But you see, the problem is, your class/objects are poorly designed.
It will not work like you expect it to work.
Am really experimenting with something so yeah its going to seem like horrendous code. ( am not dealing with HTML output exact, but nested information storage.. think of it as Russian dolls... DOLL (Level X) belongs to DOLL (level X-1), not any other and can have any number of DOLL(Level X+1)s.. but not any other type. This would be simple (in an awkward way enough if I merely wanted to know the LEVEL of the object for knowing the levels sake). For that I could assign a variable to to the class of parentLevel+1. But what I want is the child objects to have acess to the information (attributes) of the parent OBJECT ( even if they have been changed)
when I use parent:: it doesnt let me get OBJECT values, just CLASS static constants.
If I try t access a method , via parent::foo(), any $this->whatever within the foo is interpreted as the $this->whatever in the child not the parent 's.
- The goal of my experiment is to STORE each node rather than output it.
- The 'TREE' can have TRUNKS, BRANCHES, AND LEAVES.. so its not just a simple parent-child; tho each lower level should be able to know where it is "stored'
- Dymanic /recursive-able.. that means hard coding $a->branchFoo()->branchFoo()->branchFoo()->branchFoo()
- With that being said , the mechanism is internal; it's the object itself that 'knows' at which level its at and not the user/programmer .
Maybe attempting to create things via NESTING is what you mean by poor construction... I just thought it would be more intuitive if i could do it that way
I am trying to run your example. .but it says : Invalid argument supplied for foreach() in - on line 19 I will toy around with it tho