[Typo3-dev] Suggested Update in t3lib_div::makeInstance()
Christian Zehaczek
warhawk at ufo-base.de
Mon May 3 16:50:06 CEST 2004
Hello Developers,
i just needed to fix mentioned method to allow multiple inheritations, would
be nice if this one moves to the core in future:
Existing Method:
<<<snip>>>
function makeInstance($className) {
$className = class_exists("ux_".$className)?"ux_".$className:$className;
return new $className;
}
<<<snap>>>
The Better Way:
<<<snip>>>
function makeInstance($className) {
while (class_exists("ux_".$className)) {
$className = "ux_".$className;
}
return new $className;
}
<<<snap>>>
This works for t3lib_div::makeInstanceClassName() as well, allowing everyone
to extend already exenteded classes, holding the naming convention.
(eg. ux_ux_ux_t3lib_div extends ux_ux_t3lib_div)
Best regards,
Christian Zehaczek
More information about the TYPO3-dev
mailing list