URLMapContent Failsafe

Description

Include this code at the top of your template or in your init container so that in cases where a detail page is being hit outside of a URL Map Pattern, you can use the exact same code in your body without needing to check for content and pull in a widget, etc. That way your pages are just always set up to handle a single content map variable. This is also extremely handy if you need to use content fields before your page body, for instance customizing your HTML <title> or setting up Open Graph values.

Code

${esc.hash}${esc.hash} DID THE WIKI FILTER GET US SOME CONTENT? IF NOT, TRY TO GET SOME.
${esc.hash}if(!${esc.dollar}URLMapContent)
	${esc.hash}${esc.hash} IS THERE AN ID AVAILABLE?
	${esc.hash}if(${esc.dollar}UtilMethods.isSet(${esc.dollar}request.getParameter('id')))
		${esc.hash}set(${esc.dollar}URLMapContent = ${esc.dollar}dotcontent.find("${esc.dollar}request.getParameter('id')"))
	${esc.hash}${esc.hash} MAYBE THEY USED A DIFFERENT URI PARAMETER...
	${esc.hash}elseif(${esc.dollar}UtilMethods.isSet(${esc.dollar}request.getParameter('post')))
		${esc.hash}set(${esc.dollar}URLMapContent = ${esc.dollar}dotcontent.find("${esc.dollar}request.getParameter('post')"))
	${esc.hash}end
${esc.hash}end