Best MVC Practice

I am new to MVC (I use codeigniter) and wondered where I should put the cut_description function.

My model receives a list of events, including their description. If the description is too long, I will need to cut it out after the first n words and add a β€œread more” link, so the presentation will not be too cluttered.

What would be the best practice?

  • add logic to reduce after n words to the model
  • add logic to the controller
  • add it to the view?

I think 3 will be easier (I still need to scroll through the results), but I'm not sure if this will be consistent with MVC.

What do you think?

+3
source share
1 answer

, .

, , , , , , .

+3

Source: https://habr.com/ru/post/1739766/


All Articles