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.

Template Questions /

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

Method in model


Go to End


1293 Views

Avatar
timwjohn

Community Member, 98 Posts

20 October 2009 at 2:25am

Edited: 20/10/2009 2:26am

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!