converting html to dynamic, adding template