Skip to content

Instantly share code, notes, and snippets.

@stevewithington
Last active December 14, 2023 10:11
Show Gist options
  • Save stevewithington/8541766 to your computer and use it in GitHub Desktop.
Save stevewithington/8541766 to your computer and use it in GitHub Desktop.
Mura CMS : There will be times when you need to access the Mura Scope ($), but you're not in the context of a front end request. Here's an example of how you could do that, assuming your within the Application scope of Mura.
<cfscript>
// The Mura Scope : in order to access site-specific helpers (e.g., $.siteConfig()), we'll initialize it with a siteid.
$ = StructKeyExists(session, 'siteid')
? application.settingsManager.getBean('$').init(session.siteid)
: application.settingsManager.getBean('$').init('default');
// If you're not in the context of a Front-End Request, then there is NO ContentBean!
// So, we need to set it if we want to access it
// contentBean = $.getBean('content').loadBy(filename='home');
// $.setContentBean(contentBean);
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment