Problem one is already solved above. Problem two is very solvable as well. You really have a few options. Sure you can switch templating systems to one that has more control of the data -- but to me that puts you on a slippery slope. It makes it easy for you to one off break the barrier of model-view-controller design. I would have my templates show the data and form the data in the right order etc in my code. Have some sort of flag that sets how data is sorted on the screen you are working on and expose the data to the template pre sorted in that way. Once you start tossing code in your templates they become much less valuable to you.