Thursday, October 20, 2011

My answer to "What's the best way to enhance LampCMS?"

This is my answer to a Question on Support site for LampCMS project


Yes, you can write plugins for pretty much any new feature.
I call them modules. Your custom module is a class that extends the \Lampcms\Observer object
As such it has access to the all important oRegistry object from which you can get your Mongo object, Ini object, and most other important object.

You write your own methods and write your own main() method. main() is called by the Dispatcher and notifies of important events. You can perform actions based on specific event.

Some of the core features of Lampcms are already written as modules, for example FloodCheck, IpFilter as well as Search indexer and EmailNotifier.

Take a look how there are written and you can then write your own plugin the same way. Then add your plugin to the !config.ini file either to [OBSERVERS] section - plugins in that section listen to all events or to [INPUT_FILTERS] section - plugins defined there listen to events like new questions, new answers, comments - all type of user input. If you write plugin like a spam filter then you would put it in the [INPUT_FILTERS] section. It's more efficient since input filters are not notified on all events like observers, only on input events.

I am now working on the new module "Who's online" and I'm writing it as a module.

No comments:

Post a Comment