This is fine, as long as all the loop logic is display-related. Your views are going to contain some conditional logic and loops. But, consider using display widgets for modular areas. Try keeping many not-set/empty checks to display different HTML on the front-end, as well as foreach loops to display an array of a model’s One-to-Many relation. For the general purpose of displaying recent reviews on a site, you can use a method in the model that returns the latest reviews, and two display widgets that use it; one for the home page, and one for a basic unordered list.
Posted in: Yii