I have an app built around an MVC pattern. The view is php but mostly html with minimal php code embedded, stuff like this -
Welcome
One solution is to use Javascript sorting, there is some good ones for jQuery.
If that is not possible y0ou might have a look on some template solution like Smarty to handle templateing for you.