extract header,footer and fom as .html and modify the structure of Tpl files