Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS

add custom event handler?


Reply

939 Views

Avatar
Anatol

10 March 2009 at 12:16pm 126 Posts

Hi,

this is connected to my [url=http://www.silverstripe.org/customising-the-cms/show/255571]previous post[/url] - but I would like to ask the question a bit more general: Is there a simple way to add an event handler to a page type (or to all pages) without changing the core code?

E.g. could I add a function to /mysite/code/Page.php that executes some code (server side) when a user posts a comment? I've seen onBeforeWrite and onAfterWrite in the [url=http://api.silverstripe.com/]API[/url] but I'm not quite sure if or how I can squeeze some custom code between a user action (post comment) and the default code that happens in Silverstripe.

Cheers!
Anatol