MVC Philosophy

Brian Ablaza wrote:

My directory browsing app shows lists of file. If the item is a folder,
show a folder icon and link to the action that shows directory contents.
If the item is a graphics file, show a thumbnail and link to a larger
view. If the item is a non-graphics file, show an appropriate icon and
stream the file if the link is clicked.

The controller creates an array of arrays of items in the current
folder, with flags indicating the type of the item. The view iterates
over the array to create the page.

But the view code looks a lot like programming code, with if-then and
case statements to handle all the possibilities. It *feels* like it
belongs in the controller. I could remove some code into partials and
helpers, but that's really just distributing the ugliness around.

On the other hand, using a controller to build an array of html links
doesn't seem right either.

Philosophically, which way should I go?

Hmm... Personally, I think the controller should mark it as folder, graphic or other and the view should have a case statement to pick up the partial that should be used for rendering the view for it. The partial might want to use a helper for things like thumbnails, etc. if required..

Just my thoughts! :slight_smile: