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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

add custom event handler?


Go to End


1445 Views

Avatar
Anatol

126 Posts

10 March 2009 at 12:16pm

Hi,

this is connected to my previous post - 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 API 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