MVC best practice

Posted by Patrick on Stack Overflow See other posts from Stack Overflow or by Patrick
Published on 2010-04-04T15:41:16Z Indexed on 2010/04/04 15:43 UTC
Read the original article Hit count: 317

Filed under:
|

I'm new to MVC (i'm using codeigniter) and was wondering where I should put a "cut_description" function.

My model retrieves a list of events including their description. If the description is too long, I would need to cut it after the first n words, and add a "read more" link, so the view doesn't get too cluttered.

What would be the best practice? a) add the logic to cut after n words to the model; b) add the logic to the controller; c) add it to the view?

I think C would be the easier (I have to loop through results anyway), but I'm not sure this would comply with MVC.

What do you think?

© Stack Overflow or respective owner

Related posts about mvc

Related posts about codeigniter