Welcome Guest, Not a member yet? Register   Sign In
trouble getting drop menu from model
#8

[eluser]obiron2[/eluser]
There is nothing wrong with looping in the view to generate list data (e.g. dropdown options) however if you do this a lot, you may want to farm it off to a function that generates the html and returns it to the view as an html string, but this should be called from withing the view as it is a presentation decision, not a business logic one.

I use this process for rendering forms. I build all the form data in the controller and then call a generate_form($formdata) helper which produces the form with all the correct labels, ids and formatting DIVs that I require.

The big advantage is that if you want to change the rendering of repeated information, you simply have to change the function and not every view that uses it.

Obiron


Messages In This Thread
trouble getting drop menu from model - by El Forum - 02-14-2009, 11:46 PM
trouble getting drop menu from model - by El Forum - 02-15-2009, 01:25 AM
trouble getting drop menu from model - by El Forum - 02-15-2009, 02:20 AM
trouble getting drop menu from model - by El Forum - 02-15-2009, 12:58 PM
trouble getting drop menu from model - by El Forum - 02-15-2009, 01:16 PM
trouble getting drop menu from model - by El Forum - 02-15-2009, 03:41 PM
trouble getting drop menu from model - by El Forum - 02-15-2009, 04:34 PM
trouble getting drop menu from model - by El Forum - 02-16-2009, 06:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB