Jump to:

23367 Posts in 18143 Topics by 2863 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: 132 Views
  • prezet
    Avatar
    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
    Avatar
    Community Member
    504 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?

    Mo

    132 Views
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.