Modify Tpl and combined with DB connection