Reputation: 1275
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?
I think 3 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?
Upvotes: 3
Views: 486
Reputation: 61597
If you are modifying information to properly display it, it should go into the view.
I doubt it should be in the model primarily because if the data was always going to be shortened, you would probably would store it shortened.
Upvotes: 3