Last active
December 14, 2023 10:11
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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