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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

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

common functionality in all controllers


Go to End


2 Posts   1123 Views

Avatar
toddm

Community Member, 15 Posts

17 July 2008 at 12:03am

Hi,
I'd like to have access to a function from every one of my controllers. Is there a best practice for doing this?

I'm thinking of extending ContentController, adding the function and then have all my controllers extend this Controller.

Thoughts? Better ways to do it. I'm new, so I apologize if I missed a previous thread or documentation on where this is addressed.

Todd

Avatar
Willr

Forum Moderator, 5523 Posts

17 July 2008 at 9:58am

If all your custom page extend Page and their Controllers extend Page_Controller then you could just put it in Page_Controller since all the other controllers will inherit it