News Archive
PhpRiot Newsletter
Your Email Address:

More information

Getting a descendant (child) widget by name

Note: This article was originally published at Planet PHP on 30 January 2012.
Planet PHP

This script gets a descedant (child) widget by name using recursion. A name should be defined for the child previously, if not as a name is considered the class name.

The name is passed as a variable by reference, when the target is found it is stored in this variable.
This will change the variable type from string to object, this very information is used as a condition to stop further recursion.