This file contains 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
<!--- In a Mura page template ---> | |
#$.getURLForFile(fileid=$.content('extAttribute'))# | |
<!--- In a Mura component ---> | |
#$.getURLForFile(fileid=$.component('extAttribute'))# | |
<!--- In a Mura iterator ---> | |
#$.getURLForFile(fileid=item.getExtAttribute())# |
This file contains 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
<!--- | |
A brief example on how to use the 'CustomUI' option when creating a class extension in Mura CMS. | |
This example assumes you have an extended attribute called 'Page/Book'. | |
It also assumes you have an attribute set using the 'CustomUI' container/tab assignment. | |
Any extended attributes you assign to the attribute set, you are responsible for collecting | |
that data using your own form fields. Make sure the 'name' and 'id' attributes match the | |
names you've used when you created the extended attributes! For example, if you have an | |
extended attribute with a name of 'bookPublisher', make sure you have a form field with an | |
'id' and 'name' attribute of 'bookPublisher'. Check your casing too! |
This file contains 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
<cffunction | |
name="csvToArray" | |
access="public" | |
returntype="array" | |
output="false" | |
hint="I take a CSV file or CSV data value and convert it to an array of arrays based on the given field delimiter. Line delimiter is assumed to be new line / carriage return related."> | |
<!--- Define arguments. ---> | |
<cfargument | |
name="file" |
This file contains 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
<!--- Assuming you've created an extended attribute 'File' type called 'extAttributeImage' ---> | |
<!--- In a Mura Page Template ---> | |
#$.createHREFForImage(fileid=$.content('extAttributeImage'),size='myCustomSize')# | |
<!--- In a Mura Component ---> | |
#$.createHREFForImage(fileid=$.component('extAttributeImage'),size='myCustomSize')# | |
<!--- From a site extended attribute ---> | |
#$.createHREFForImage(fileid=$.siteConfig('extAttributeImage'),size='myCustomSize')# |
This file contains 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
loadEmbedShepherd(function(){ | |
if(window.wistiaEmbeds===undefined){ | |
return; | |
} | |
window.wistiaEmbeds.onFind(function(video) { | |
video.addPlugin("marketo", { | |
src: "js/MarketoWistiaPlugin.js", | |
outsideIframe: true | |
}); | |
}); |
This file contains 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
<cfset application.serviceFactory.getBean('fileManager').cleanFileCache('[siteid]') /> |
This file contains 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
<!--- 1) Create a form with a hidden form field like shown below, and place it in a layout template, or in a display object, etc. ---> | |
<form method="post"> | |
<input type="text" name="myField" value="Some Value" /> | |
<input type="hidden" name="myFormIsSubmitted" value="true"> | |
<input type="submit"> | |
</form> | |
<cfscript> | |
// 2) In the eventHandler.cfc (Site, Theme, Plugin, or other custom handler) you could listen for the even in one of Mura's eventHandlers such as 'onRenderStart' | |
public any function onRenderStart($){ |
This file contains 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> | |
// Place these methods in your Site, Theme, or Plugin's eventHandler.cfc | |
public any function onBeforeUserSave($) { | |
var newUserBean = arguments.$.event('userBean'); | |
var oldUserBean = arguments.$.getBean('user').loadBy(userid=arguments.$.event('userid')); | |
// if you want to stuff the oldUserBean in the event | |
// $.event('oldUserBean', oldUserBean); |
This file contains 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
<!--- Drop this into your site eventhandler.cfc ---> | |
<cffunction name="onAfterFormSubmitSave" output="true"> | |
<cfif $.event('formid') EQ '{ID of the Mura form}'> | |
<!--- Get the form result ---> | |
<cfset formBean = $.event().getValue('formresult')> | |
<!--- Get a new content bean ---> | |
<cfset cBean = application.contentManager.getBean()> | |
<!--- Set the new node attributes ---> | |
<cfset cBean.setSiteID($.event('siteid'))> |
This file contains 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
component extends='mura.cfobject' { | |
// drop this in your site or theme eventHandler.cfc | |
public any function onRenderStart($) { | |
// allow for a 'View As PDF' link (e.g., <a href="./?viewAsPDF=1">View As PDF</a>) | |
if ( IsBoolean(arguments.$.event('viewAsPDF')) && arguments.$.event('viewAsPDF') ) { | |
arguments.$.content('template', 'pdf.cfm'); | |
} | |
NewerOlder