Dynamically Define a Mura CMS Theme's Display Regions

A question came up recently regarding Mura CMS and how to alter the available content object display regions. This is actually quite simple to control from within the Admin area of the site by going to Site Settings > Select the Site > Select the Display Regions Tab and then choose the Number of Display Regions, select the Primary Display Region and define the Display Region Names as a carrot "^" delimited list.

However, this particular inquisitor was actually interested in how to control these settings from within a specific theme itself. Luckily, as with most things in Mura, it really isn't all that difficult to do.

Since this is not something we would want to happen everytime a page loads, it would probably work best to use the onApplicationLoad() method in the theme's eventHandler.cfc. This way, it will only be executed whenever the entire application is loaded. The next thing we need to figure out is what methods we need to call and how to tell Mura to save our settings.

So, as I've pointed other people in the past, most all of the important methods that comprise the Mura engine can be found under the /requirements/mura/ directory. Since we're dealing with Site Settings, we'll want to review the methods available to us under the 'settings' directory. There you'll find settingsManager.cfc among other files. Within this file, you'll be able to locate a method called update() which takes an argument called data which is required to be a struct/object. The data object should have a key which contains the siteid of the site we wish to edit the settings for. Then, we can update any of the available settings we wish!

Here's some code for you to play around with:

<cffunction name="onApplicationLoad">
    <cfargument name="$" />
        var local = {};
        // dynamically alter the available display regions from within a theme
        local.data = {
            siteID = $.siteConfig('siteid')
            , columnCount = 5
            , primaryColumn = 3
            , columnNames = 'Test^Left Column^Main Content^Right Column^Footer'
        local.siteBean = $.getBean('settingsManager');

If you're wondering what settings are available to you, simply do a dump of all the existing values:

<cfdump var="#$.siteConfig().getAllValues()#" />

Hope that helps someone else trying to update their Mura Site Settings from within the theme itself.


just got to this amazing site not long ago. It’s really very nice and I will only say thanks for sharing this great information with us.View at custom essay writing service Your article is very nice thank you for share this information. It is very useful for all peoples there are all possibilities to provide for this blog.
page if you are interesting on online essay services.
# Posted By mariakim | 11/18/17 1:12 AM
Incredible posting this is from you. I am really and truly thrilled to read this marvelous post. You've really impressed me today. I hope you'll continue to do so!
# Posted By olymptrade | 5/21/18 7:25 PM
There are such a large number of kinds of articles accessible. I extremely get a kick out of the chance to read the one which you have partaken in this post. Each article has novel and particular characteristics to its write. We can see some same characters in all articles. Writers motivate opportunity to share imperative and convincing data by inquiring about and framing writing thought and altering work to the readers. You have completed an incredible work. I truly making the most of your posts
# Posted By usawriters | 6/28/18 1:21 AM
When fabricating your topics you will need to get dynamic substance from your Mura site to show meta data, titles, body et cetera. For Page level factors, you have to get to the substance scope for that page. This is finished by utilizing content.
# Posted By buy coursework online | 9/19/18 10:22 AM
Here are the many feature to see remembered passwords in microsoft edge in system this is the way for batter working and save the all data and web site to set the password thanks.
# Posted By microsoft edge password manager | 11/12/18 3:46 AM
# Posted By Teri Quinn | 11/17/18 6:14 AM

© 2019, Stephen J. Withington, Jr.  |  BlogCFC was created by Raymond Camden – Version 5.9.004

Creative Commons License  |  This work is licensed under a Creative Commons Attribution 3.0 Unported License.  |  Hosted by Hostek.com