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:
<cfargument name="$" />
<cfscript>
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');
local.siteBean.update(local.data);
</cfscript>
</cffunction>
If you're wondering what settings are available to you, simply do a dump of all the existing values:
Hope that helps someone else trying to update their Mura Site Settings from within the theme itself.
Cheers!
page if you are interesting on online essay services.
https://www.essaysolution.co.uk/write-my-essay
https://whataburgersurveyy.club/
It is consistently those significant things in life that we underestimate.
A huge number of things will ring a bell now, however you will in all probability overlook one. It is so basic but then it decides our lives each second.
BREATHING!
Noson® AG has been managing this test since 2013.
As a Swiss startup, we have helped more than 3,600 individuals inhale ordinarily once more.
This reaches from proficient competitors with nasal wing suction wonders to individuals with wheezing issues.
Presently we offer our most recent advancement to the worldwide market so as to support mankind.
I regularly visit this site to check out the events and functions and sometimes for resources. However, it has been a while that you have shared some news about latest or upcoming events.
The Woodleigh Residences is a residential property that integrates with MRT, shopping malls and it’s located at Bidadari Park Drive, Woodleigh within the heart of Woodleigh and Bidadari New Town. Woodleigh Residences comprises of a total of 667 units consisting of units from 2 to 4 bedrooms.
A stuffy nose is a typical daily problem, especially in the cold season. However, many people are particularly affected by this problem due to anatomical malformations of the nose or functional disorders.
https://www.elitepassion.club/call-girls/anna-naga...
https://www.elitepassion.club/call-girls/egmore
https://www.elitepassion.club/call-girls/guindy
and am really glad to have tracked down it.