get template from db