Only try to generate list html if there are media files
Return the HTML rather than echo it (more control)