Tuesday, April 17, 2007

Recent Comments plugin - against MVC?

The Habari project is supposed to follow the MVC model of design. I have yet to fully understand it in plain English.

Owen was of the opinion that I shouldn't have to do a plugin for 'Recent Comments' as a theme designer could easily display 'recent comments' using the MVC design feature built into Habari. The Wiki tells you how.

Owen is right of course, if I understood him correctly, but using a plugin makes thing clean, tidy and flexible, e.g. I need only one line to get what I want

RecentComments::comments('5','-4','10')


First parameter 5 is to show 5 comments, second '-4' is time zone difference in hours and last parameter '10' is to truncate comment string to 10 words.

Now I have removed my first plugin and moved the class to theme.php. I prefer using just one line to display Recent Comments instead of following the example in the Wiki.

No comments:

Post a Comment