dynamic templating with example