Allow user-defined path for compiled templates.

This allows the Widgets plugin to be used in wikifarms and keeps
compatibility with previous versions; solves bug 37678.

Change-Id: I4651f3fc04f09ca442608f58c1b379430f752d57