How to Create Dynamic Content Display Objects in Mura CMS with MuraFW1 Plugins
If you've ever created a MuraFW1 plugin for Mura CMS (which this article assumes by the way!), you may have wondered how to go about creating dynamic Content Display Objects. Doing so would enable an end-user to edit a page, go to the Content Objects tab, select Plugins from the Available Content Objects dropdown, select your plugin, then select your "dynamic display object" which would then fire off and return yet form field containing the dynamic list of options available to be assigned to the desired content display region.
Still with me? Great!
Ultimately, there's three main parts to this:
1. Create the display method, i.e., myDisplay
2. Then create an "OptionsRender" display method which follows the naming convention of myDisplayOptionsRender
3. Finally, we'll add the basic display method (i.e., myDisplay) to the config.xml.cfm's list of available displayObjects
1. Create The Display Method
In the pluginEventHandler.cfc, we can add our basic display method. Ultimately, we should eventually expect a JSON formatted variable to be passed in via $.event('params'). Obviously, we'll need to deserialize the JSON, and once we do that, we can do whatever we like with it. An easy way to pass this information over to FW/1 is to stuff any desired variables into the URL scope ... and then call the typical renderApp() method and let FW/1 take over from there. Check out our simple example below which is expecting to find "whateverID" to be in the unpacked params:
<cfargument name="$" hint="mura scope" />
<cfscript>
var local = {};
// grab everything that's been passed in from OptionsRender() and unpack the JSON option values that were saved
local.params = DeserializeJSON($.event('params'));
// stuff selected WhateverID into the url scope so that fw1 will pick it up
if ( StructKeyExists(local.params, 'whateverid') ) {
url.whateverid = local.params.whateverid;
};
// something went wrong ... so let's not bomb everything
if ( not StructKeyExists(url, 'whateverid') ) {
return '';
} else {
return renderApp($,'public:main.default');
};
</cfscript>
</cffunction>
2. Create An "OptionsRender" Method
Now for the magical part! Whatever you named your displayMethod, you simply append "OptionsRender" to the end of it. So if you have dspWidgets, then you would have dspWidgetsOptionsRender as an available method. In the example below, I'm creating a simple recordset which we'll then loop over to output the options and dynamically generate the option value which is a tilde (~) separated list where the last item in the list is a JSON formatted list of params...yes, the very same params our display method in step one is expecting to find!
<cfargument name="$" />
<cfscript>
var local = {};
// this recordset could come from anywhere ... doesn't even have to be a recordset, could be anything that contains data that you want to grab options from
local.rs = QueryNew('WhateverID,WhateverTitle,WhateverField', 'VarChar,VarChar,VarChar');
QueryAddRow(local.rs, 1);
QuerySetCell(local.rs,'WhateverID', 'anyid-1', 1);
QuerySetCell(local.rs,'WhateverTitle', 'My Awesome Title', 1);
QuerySetCell(local.rs, 'WhateverField', 'Hi Ho Cherry-O', 1);
QueryAddRow(local.rs, 1);
QuerySetCell(local.rs, 'WhateverID', 'anyid-2', 2);
QuerySetCell(local.rs, 'WhateverTitle', 'Another Great Title', 2);
QuerySetCell(local.rs, 'WhateverField', 'Knick Knack Paddy Whack', 2);
</cfscript>
<cfsavecontent variable="local.str">
<cfif local.rs.recordcount>
<select name="availableObjects" id="availableObjects" class="dropdown">
<!--- we're going to pack everything up into a tilde (~) separated list where the last item in the is a JSON formatted list of params to be passed over to the display method --->
<cfoutput query="local.rs">
<option value="plugin~#HTMLEditFormat(Replace(WhateverTitle,'~','','ALL'))#~#$.event('objectid')#~{'whateverid':'#WhateverID#','anotherfield':'#WhateverField#'}">
#HTMLEditFormat(WhateverTitle)#
</option>
</cfoutput>
</select>
<cfelse>
<p><em>Please create some Whatevers first.</em></p>
</cfif>
</cfsavecontent>
<cfreturn local.str />
</cffunction>
3. Add The Rendering Method To config.xml.cfm
The final step in all this is to add your basic displayMethod to your config.xml.cfm file so that it will be registered with Mura CMS. Once it is, then we should expect to see it show up in the Content Objects tab when someone selects our plugin.
<displayobject name="Display Whatever" displaymethod="dspWhatever" component="pluginEventHandler" persist="false" />
</displayobjects>
That's it! Hopefully this helps anyone else who is creating FW/1 plugins for Mura CMS.
Cheers!
http://www.grantshepert.com/post.cfm/advanced-plug...
But your post is an excellent addition.
yeah, he had a great post on this topic. one point i wanted to illustrate is that it's possible to do this without actually having to modify the MuraFW1 plugin's renderApp() method ... it's very easy to just stuff anything the plugin is already listening for into the url scope, etc. so that fw1 will just pick it up and respond if necessary.
cheers!
I'll poke around your site and Grant's more to find the answer to my own question, but if you can i'd appreciate any suggested approach.
All the best,
David
I want to call public:dept.list from the below displayobject
<displayobject name="depList" displaymethod="renderApp(action='public:dept.list')" component="pluginEventHandler" persist="false" />
But I get only errors:
" Ensure that the method is defined, and that it is spelled correctly.
Message The method renderApp(action='public:dept.list') was not found in component D:\Zend\Apache2\htdocs\learnMura.loc\plugins\muraFW1\pluginEventHandler.cfc."
Actually list method on dept controller exists.
Sorry for the delay, I was on vacation and had limited access to internet.
Anyway, in your case, simply create a method in the pluginEventHandler.cfc called something like "dspDepList" which returns renderApp(action='public:dep.list')
For example:
<displayobject name="depList" displaymethod="dspDepList" component="pluginEventHandler" persist="false" />
Then,
<cffunction name="dspDepList">
<cfreturn renderApp(action='public:dep.list') />
</cffunction>
Hope that helps!
https://penzu.com/public/b04cd1d0
http://mcdsurvey.mystrikingly.com/blog/walgreensli...
https://mcdvoicesurvey.food.blog/2019/08/16/paymyd...
Garmin Striker 4 Built-in GPS Fish Finder, is found to be one of the best fish finder brand GPS. It’s comparatively small with other fish finders but still, it does its job perfectly. Each and everything will be clear to you due to its high colour contrasts and brightness. The good thing about it is you can mark your hot spots to make fish catching easier for you regardless of whether you are in open water or in the lake.
https://bestfishfinderreviewz.com/
Bona Mega Wood Floor Finish, is a floor finish specially designed for wood floors. RUST-OLEUM Varathane Enhancing the natural beauty of the floor and retaining its original color, it provides maximum shine and makes your floor look good as new. This is a clear liquid that gives extraordinary clean and clear finish to the floors leaving it bright and sparkly.
http://waterbasedpolyurethane.com/
A best spray tan solution, is a method of giving you tanned skin for several days, without having to reveal yourself to deadly UV light as you would in a tanning salon or by sunbathing. There are several primary qualities that a tanning solution should have so that you attain natural-looking coverage and a great tanned color that not only shines up your complexion but also persists for a pretty long time .Sunless tanners are available in lotion, gel, spray, powder, and mousse. There are also staged tanners for deeper and longer-lasting results.
http://spraytansolutionreview.com/
Digisiz offers complete range of online marketing services including SEO, SMO & PPC. We are working in Italy and Pakistan and had a proven record in the field of Digital Marketing. We have been working in the field of Online Marketing for the last 5 to 6 years. We can help you get better exposure for your products & campaigns. Improve your digital presence positively engage with your community.
https://www.digisiz.com/
The game story is all about dinosaurs on an unstable island. In the Jurassic world, they can freely move, and we have to hunt them and collect their DNA .The fusion of dinosaurs can boost the level of players.The number of resources offered in Jurassic world alive game in the result of rewards like bucks, darts, coins, incubator.Artificial intelligence used to communicate dinosaurs and the sci fictions ideas make every efforts to clone dinosaurs..
http://Jurassicworldalivehack.com
Darkness Rises is a mobile game that is available on both Android and iOS. Darkness rises is the third chapter of the great Dark Avengers series brought to you by NEXON. The aim of the game is to use one of the many playable classes and back against an army of devils! This lone Action RPG blends amazing graphics with an intense story to form a game unlike any other.
https://www.darknessrisesgame.com/
US Open Tennis Kenin: On the WTA side, the year was off to a great start, as we saw a new Grand Slam champion in Sofia Kenin. Kenin won the final in Melbourne after defeating Garbine Muguruza. Many are expecting great things from the American and she has now made her intentions for the US Open known.
https://etandoz.com/category/us-open/
US Open Tennis Kenin: On the WTA side, the year was off to a great start, as we saw a new Grand Slam champion in Sofia Kenin. Kenin won the final in Melbourne after defeating Garbine Muguruza. Many are expecting great things from the American and she has now made her intentions for the US Open known.
https://etandoz.com/category/us-open/
US Open Tennis Kenin: On the WTA side, the year was off to a great start, as we saw a new Grand Slam champion in Sofia Kenin. Kenin won the final in Melbourne after defeating Garbine Muguruza. Many are expecting great things from the American and she has now made her intentions for the US Open known.
https://etandoz.com/category/us-open/
US Open Tennis Finalists The US Open is a Grand Slam tennis competition held in New York City at the USTA Billie Jean King National Tennis Center in the zone of Flushing Meadows. In 1968, this competition got open to experts and has been referred to from that point forward as the US Open.
https://www.viralhub24.com/us-open-2020/
http://fanee.in/
http://www.escortgirlsgurgaon.in/
Great article, much obliged for the share. The best thing about modern Healthcare is that it is upgrading every single day, ensuring life saving tactics.
https://arpitajain.org/mumbai-call-girls/
http://www.shalinibangaloreescorts.in/
http://www.bangalore-escorts.in/
http://www.atrigarg.in/
Your article holds so much potential that it can change an individual's mind for good. I've shared this among my circle to amplify the benefits. One should have to look for quality skincare, here are cool & cool products which will ensure your skin's true identity.<a href="https://www.coolandcool.ae/">Baby Wipes Online UAE
</a>
</a>
<a href="https://www.shoezone.com.pk//">shoes brands in pakistan</a>
Watch Hulu shows and movies in perfect sync with people online and always stay connected from different locations. Hulu Watch Party is a free extension exclusively created to provide worldwide Hulu streamers with a seamless streaming experience in sync with their friends/family.
Watch Disney Plus, shows, movies, and videos sync with people online, and have virtual parties. Install the Disney Plus Watch Party extension and watch your favorite shows with people living far from you. Download the extension for Free and have fun movie nights even while living away from them.
The users experiencing an issue with the Netgear WiFi Extender Setup must perform the steps provided below. Therefore, through the help of the steps described below, the users can complete the Netgear Extender setup procedure.
Coinbase is a well-known and trustworthy cryptocurrency exchange based in the United States, with millions of users worldwide. Thus, the users can purchase and trade various cryptocurrencies, including litecoin, ethereum, bitcoin, and others.
Coinbase is a well-known and trustworthy cryptocurrency exchange based in the United States, with millions of users worldwide. Thus, the users can purchase and trade various cryptocurrencies, including litecoin, ethereum, bitcoin, and others.