Skip to content

Instantly share code, notes, and snippets.

@modmedia
modmedia / mura-amazon-s3-variables.cfm
Created January 25, 2014 02:19
Config variables for connecting Mura CMS to Amazons3
<!--- add/edit these in your settings.ini.cfm --->
filestore=s3
filestoreaccessinfo=access Key ID^secret Access Key^bucket-name
filedir=s3://myAccessKey:[email protected]/bucket-name/folder
assetpath=http://s3.amazonaws.com/bucket-name/folder
@modmedia
modmedia / config.xml.cfm
Created January 18, 2014 22:17
Disable robots per page in Mura
<!--- Add this to your config.xml.cfm --->
<!--- Extend Page/Default. You can also choose to extend Base/Default for all objects --->
<extension type="Page" subType="Default">
<attributeset name="Crawling" container="default">
<attribute
name="disableCrawling"
label="Disable Crawling"
hint="Prevent this page from being indexed by search engines"
type="RadioGroup"
@modmedia
modmedia / facebook-script.cfm
Created January 18, 2014 22:10
Add social icons to Mura pages
<!--- Add to the top of your page body in the template --->
<!--- Facebook Share Script --->
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js##xfbml=1&appId=xxxxxxxxxxxxx";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script><!--- End Facebook Share Script --->
@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 --->
@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-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 / 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 / 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 / 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 / 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')#