|
XML Config vs. Dynamic Loading
Hola DevHeads!
In my CMS, I currently employ the practice of dynamically loading class files from a "lib" directory when a specific feature is requested. For example, when a user requests the "news engine", the core of my engine runs through the [root]/ext/news/lib folder looking for all user.classname.php files. It then includes all class files prior to execution. While I do try to keep the number of files to a minimum, there are instances when a lib(rary) may contain up to 15 or more class files. The reason I adopted this approach was to be able to "drop-and-load" new features on the fly without changing any core files. It also allows me to add new enhancements pretty easily.
Now that I have made my CMS XML aware, I am starting to wonder if the auto-generation and subsequent parsing of an XML file (with class pointers) is not a better method to employ. For example, when I add a new module I can set-up an install system where I pass the parameter of "install=true" to signal to an extension the need to create a config file for itself. If I update the extension at a later time, I can pass "reload=true". And naturally "unistall=true". All from an admin protected interface of course.
So... what do *you* think would be faster by way of performance, the dynamic loading of a target directory or the parsing of an XML file? In the end, both approaches utilize the time-consuming "include" directive.
Thoughts?
Cheers,
Trevor
__________________
The Universe Our God, Nature Our Temple, Love And Duty Our Religion, Knowledge Our Happiness And Consolation, Death The Dissolution Of The Ego, And The Return To Eternity.
|