Jump to:

3432 Posts in 1025 Topics by 865 members

Template Questions

SilverStripe Forums » Template Questions » Method in model

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

Page: 1
Go to End
Author Topic: 665 Views
  • timwjohn
    Avatar
    Community Member
    98 Posts

    Method in model Link to this post

    Hi everyone,

    I've recently extended PageComments using the method figured out here: http://silverstripe.org/general-questions/show/266651#post266651.

    I added the email field to display the commenters' gravatars.

    Next thing I did was add a method to my extended PageComments class called GravatarURL, which generates the URL from the new email field. I can access this from my custom comments template in a control Comments block, nice and easy.

    My question is about good practice, as my MVC understanding is a little grey in areas.

    Is it acceptable to stick my GravatarURL method in the extended PageComments model, or should I extend PageComments_Controller and put the method in there?

    Sure it works as it is, but I think doing things right is important... Thanks!

    665 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.