The following is an example of parsing a .vm file that sits outside of the current theme context. This technique can be used to display themes based on user or some other switch – regardless of what theme is set in the CMS. This is bare bones; It’s likely you’ll need to set other context-specific variables to make this work. But, once you see the technique, filling in the blanks should be easy. Also, keep in mind that since these context paths are open, velocity files which exist out on the web can also be parsed.
Finally, this technique can be used in the same way Liferay processes $init.vm. You can have a dedicated context that includes core .vm files which are always parsed, regardless of the theme.
#parse ($init)
#*
##INSERT LOGIC TO ACQUIRE
##THEME CONTEXT NAME
#set ($!themeContextName = "")
*#
#evaluate($theme.include($themeServletContext.getContext("/$!themeContextName"),"/templates/portal_normal.vm"))
proxy_theme/_diffs/templates/portal_normal.vm
For fun, parse this:
http://www.monsterenergy.com
http://www.monsterenergy.com/monster-energy-theme/templates/portal_normal.vm

