Hi Holger,
thanks for pointing this issue, that we have not considered.
I think this can be solved by putting the class definitions into
separate PHP files.
In this case "moduleparents.php" stores a multidimensional array, that
contains the class chains.
For example:
<?php
// Condition: The folder "modules/parents" uses the same structure as in
"modules" folder.
// Array with class chains
$aClassChains = array(
'oxArticle' =>
array('modules/parents/mayflower/mfarticle_parent.php',
'modules/mayflower/mfarticle.php',
'modules/parents/azarticle_parent.php', 'modules/azarticle.php'),
);
// Some code for loading the class chain.
function oxAutoload($sClassName)
{
include "core/{$sClassName}base.php";
if (array_key_exists($sClassName, $aClassChains)) {
// array_walk is not faster than foreach, but "include" doesn't
work with array_walk.
foreach ($aClassChains{$sClassName] as $sIncludeFile) {
include $sIncludeFile;
}
}
include "modules/parents/{$sClassName}.php";
}
?>
The class files, which contains bases for the most classes (such as
oxSuperCfg, oxBase or oxView), can be loaded permanently.
Best regards,
Stefan Krenz
Am 10.05.2011 19:24, schrieb Holger Kohnen:
> Hi,
>
> i think this a nice idea, but it wont work:
>
> If you require the file: mfarticle.php
> mfArticle_parent have to be defined.
>
> And if you require the file: moduleparents.php
> mfArticle have to be defined.
>
> So you got a hen-egg-Problem.
>
> best regards, Holger
>
>
--
Stefan Krenz Mayflower GmbH
Pleichertorstraße 2 Tel.: +49 931 359 65 11 63
D-97070 Würzburg Fax : +49 931 359 65 28
[email protected] http://www.mayflower.de
Mayflower GmbH, Standort Würzburg
Firmensitz: Mannhardtstraße 6, 80538 München
Registergericht: Amtsgericht München, HRB 142039
Geschäftsführer: Gregor Streng, Björn Schotte,
Albrecht Günther, Johann-Peter Hartmann
_______________________________________________
dev-general mailing list
[email protected]
http://dir.gmane.org/gmane.comp.php.oxid.general