Jump to:

23552 Posts in 19380 Topics by 2891 members

General Questions

SilverStripe Forums » General Questions » Method location best practises

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

Page: 1
Go to End
Author Topic: 166 Views
  • prezet
    Community Member
    5 Posts

    Method location best practises Link to this post

    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?

  • Mo
    Community Member
    508 Posts

    Re: Method location best practises Link to this post

    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?


Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.