new filename2template() function