If you follow the Model View Controller (MVC) model, you should do all of the 
clever stuff in your controller and just use the view to render the result.

When you invoke the view, you pass a structure with it contains the data to 
display.  The trick is to design your structure to contain all the data that 
the views needs.  In your case that might be a structure containing a total and 
a slice containing numbers.  In the view you iterate through the slice 
displaying each number, and then display the total.  If you want several 
columns then you might pass a structure containing a total and a slice of 
structures, where each structure contains the values for one row.

Another typical example of this kind of thing is a page that contains some 
validated data with error messages.  In that case, your structure would contain 
the data and the error messages.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to