query and html templatin complete