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.

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   847 Views

Avatar
prezet

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?

Avatar
Mo

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?

Mo