Skip to content

Instantly share code, notes, and snippets.

@modmedia
modmedia / muraCreateContentNodeFromForm.cfm
Last active December 27, 2015 14:39
Create a Mura content node from a Mura form
<!--- 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'))>
@modmedia
modmedia / muraSubmitFormDataToSalesForce.cfm
Last active December 29, 2015 15:09
Submit data from a Mura form to Sales Force
<cffunction name="onAfterFormSubmitSave">
<cfargument name="$">
<cfif $.content('title') eq "{content Title}">
<!--- Send Sales Leads to SalesForce --->
<cfhttp method="post" url="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8">
<cfhttpparam type="formfield" name="oid" value="XXXXXXXXXXX"/>
<cfhttpparam type="formfield" name="retURL" value="http://www.domain.com"/>
<!---
<cfhttpparam type="formfield" name="debug" value="1"/>
<cfhttpparam type="formfield" name="debugEmail" value="info@domain.com"/>
@modmedia
modmedia / isotopeCSS.cfm
Last active January 2, 2016 15:19
Create an isotope gallery with Mura Categories as filters
<!--- if using CFStatic --->
<cf_CacheOMatic key="isotopeCSS">
#$.static()
.include('/css/isotope/')
.renderIncludes('css')#
</cf_CacheOMatic>
<!--- Static CSS Include --->
<!--- <link rel="stylesheet" href="#$.siteConfig('themeAssetPath')#/css/isotope/isotope.css"> --->
@modmedia
modmedia / muraDisplayExtendedAttributeImage.cfm
Created January 9, 2014 18:55
Method on displaying Mura extended attribute images, including custom image sizes
<!--- Assuming you've created an extended attribute 'File' type called 'extAttributeImage' --->
<!--- In a Mura Page Template --->
#$.createHREFForImage(filename=$.content('extAttributeImage'),size='myCustomSize')#
<!--- In a Mura Component --->
#$.createHREFForImage(filename=$.component('extAttributeImage'),size='myCustomSize')#
<!--- In the context of an iterator --->
#$.createHREFForImage(filename=item.getExtAttributeImage(),size='myCustomSize')#
@modmedia
modmedia / slatwallPredefinedSKU.cfm
Created January 18, 2014 21:52
Slatwall - Load a product with a preset sku configuration defined by a url variable.
<!--- Assuming you have a url query called "sku", i.e. ?sku=12345678 --->
<!--- load product options by predefined SKU --->
<cfset defaultSelectedOptions = $.slatwall.getEntity('Sku', 'url.sku').getOptionsIDList() />
@modmedia
modmedia / slatwallCreateNewProducts.cfm
Created January 18, 2014 21:53
Slatwall - Create new products programatically
<!--- Create new Slatwall Object Programatically --->
<cfset newBrand = $.slatwall.newEntity('Brand') />
<cfset newBrand.setBrandName("Hello World") />
<cfset newBrand.setURLTitle("hello-world") />
<cfset newbrand = $.slatwall.saveEntity( newBrand ) />
<!--- Update existing Slatwall Object Programatically --->
@modmedia
modmedia / muraExtendedAttributeFeedList.cfm
Created January 18, 2014 21:56
Populate Mura extended attribute select list with Mura feeds
<!--- Add to site Content Renderer --->
<cffunction name="feedList">
<cfargument name="columnName" type="string" required="Yes">
<cfargument name="delimiter" type="string" default=",">
<cfset var q = application.feedManager.getFeeds(siteId = $.event('siteId'),type='Local')>
<cfreturn arrayToList(q[arguments.columnName].toArray(), arguments.delimiter)>
</cffunction>
@modmedia
modmedia / mura-Extended-Attribute-File.cfm
Created January 18, 2014 22:01
Get URL for a Mura extended attribute file
<!--- In a Mura page template --->
#$.getURLForFile(filename=$.content('extAttribute')#
<!--- In a Mura component --->
#$.getURLForFile(filename=$.component('extAttribute')#
<!--- In a Mura iterator --->
#$.getURLForFile(filename=item.getExtAttribute())#
@modmedia
modmedia / mura-reset-iterator.cfm
Last active January 3, 2016 17:39
Reset the Mura iterator to output content multiple times
<!--- Sometimes you need to output the contents of an iterator multiple times. For example, for a slider with navigation, you may want to output the links as an unordered list and the images as divs --->
<cfoutput>
<cfset feed=$.getBean("feed").loadBy(name="Feed Name",siteID=$.event("siteid"))>
<cfset iterator=feed.getIterator()>
<cfif iterator.hasNext()>
<ul>
<!--- The list --->
@modmedia
modmedia / mura-parent-scope.cfm
Created January 18, 2014 22:07
Mura parent scope
<!--- Get the parent of a page --->
#$.content().getParent()#
<!--- Get the Paren't title --->
#$.content().getParent().getTitle()#
<!--- Get the Parent's image --->
#$.content().getParent().getImageURL('large')#
<!--- You could also simply set the parent in a variable and grab the objects accordingly --->