Templates and mysql integration