Don't access database from custom tags. Pass data you need as a parameter and leave GUI concerns to custom tags.