0

I am using PHP.

I'm building a fully modular CMS, which is destined for the public. Some people might view this as a framework, but I intend to write a set of extensions for it, extensions that will make it a CMS :P

Because it's completely modular I have a problem figuring out how to load extensions.

Practically I need to get the list of active extensions, so I can load them inside my base class. I load them by reading some file headers, which contain a "dependency" field. That field decides the order in which I have to instantiate the objects.

The problem is that when the CMS starts I have no database interface, because that's an extension too, so I can't store the active extensions list in the database :)

You might ask how are extensions activated in the first place. Well - in the administration interface, which is an extension as well (obviously on first install of the CMS there will be some extensions active by default).

Could writing that list inside a text file be a solution? The problem is that a lot of hosts are not very nice with scripts when they write files. And since this CMS is public I might have a problem here?

3
  • It appears as if you are asking very specific details about implementing a mechanism for loading extensions. This can look very different in different languages. Some languages have libraries that support this out of the box. I'd suggest that you include more details about the technology you are using.
    – Manfred
    Feb 26, 2012 at 0:20
  • I have to echo @John - for example if you're using .NET there's a fairly obvious answer (MEF) and some other possibilities (applies to more than .NET) if using containers to resolve dependencies.
    – Murph
    Feb 27, 2012 at 13:19
  • I am using PHP.
    – Ella
    Feb 27, 2012 at 16:06

1 Answer 1

1

"(obviously on first install of the CMS there will be some extensions active by default)."

Isn't this the answer? Your app has to have some core functionality before it's extended. A mechanism to retain the configured extensions and to discover or add additional extensions is essential. If you want to maintain the ability to replace both the data store and the process which loads extensions with other extensions, you will still need that bootstrap extension loader as part of your base functionality.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.