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:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Method location best practises

Go to End

2 Posts   524 Views


Community Member, 6 Posts

1 May 2014 at 6:09am

When choosing whether to place my template method in the Controller or the Model - what are the general best practises?

For instance I have a method to get a simple 'copyright' strapline that sits in the footer. It does a couple of things with PHP date, so would something like this be a method on the controller or the model? Both work fine...

Any guidelines?


Community Member, 541 Posts

22 May 2014 at 12:03pm

If working with dates don't forget you can call the $Now variable direct from your template.

For your scenario, I would most likley add the method to your controller though.

Hope that helps?