added option to use folders for template files which are extracted from url pattern