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.

General Questions /

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

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

Method location best practises


Reply


2 Posts   228 Views

Avatar
prezet

Community Member, 5 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?

Avatar
Mo

Community Member, 510 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?

Mo