Skip to content

Instantly share code, notes, and snippets.

@JonasEriksson
Forked from Dan4IT/extendedAttributes.cfm
Created January 17, 2016 01:13
Show Gist options
  • Save JonasEriksson/526b193ce8ccd12aaafa to your computer and use it in GitHub Desktop.
Save JonasEriksson/526b193ce8ccd12aaafa to your computer and use it in GitHub Desktop.
Mura Extended Attributes
<!--- There are many ways you can display extended attributes. The most common way to display the value of an attribute is to use the content bean from the event upon rendering and ask for the attribute. This can be done by using the below code: --->
<cfoutput>#$.content( {attributeName} )#</cfoutput>
<cfoutput>#$.content('productPrice')#</cfoutput>
[mura]$.content('productPrice')[/mura]
<!--- Display Extended Attribute Image, including custom image size - within Iterator --->
<img alt="#sub1.getMenuTitle()#" class="img-responsive" src="#$.getURLForImage(sub1.getfilethumbnail(size = 'standardimage'))#">
<!--- 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')#
<!--- 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())#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment