Skip to content

Instantly share code, notes, and snippets.

@JonasEriksson
Forked from ronnieduke/Code Snippets
Created January 17, 2016 01:13
Show Gist options
  • Save JonasEriksson/8de206a0dcf59b48db6f to your computer and use it in GitHub Desktop.
Save JonasEriksson/8de206a0dcf59b48db6f to your computer and use it in GitHub Desktop.
Mura Code Snippets
=============================
Content Image
=============================
<img src="#$.content().getImageURL(size='large')#" />
=============================
Extended Attribute Image
=============================
<!--- First, create an extended attribute with the type of 'File' --->
<img src="#$.createHREFForImage(filename=$.content('myExtAttribute'))#" />
<!--- First, Create a feed in your Admin > Content Collections --->
<cfoutput>
<cfset feed=$.getBean("feed").loadBy(name="Feed Name",siteID=$.event("siteid"))>
<cfset iterator=feed.getIterator()>
<cfif iterator.hasNext()>
<div>
<cfloop condition="iterator.hasNext()">
<cfset item=iterator.next()>
<p>looped content here</p>
</cfloop>
</div>
</cfif>
</cfoutput>
=============================
Theme Asset Path
=============================
#$.siteConfig('themeAssetPath')#
=============================
Display Regions
=============================
#$.dspObjects(1)# - Left Sidebar
#$.dspObjects(2)# - Main Content
#$.dspObjects(3)# - Right Sidebar
=============================
Body
=============================
#$.dspBody(
body=$.content('body')
, pageTitle=$.content('title') <!--- Change to '' to exclude the page title --->
, crumbList=false
, showMetaImage=true
, metaImageClass='thumbnail'
)#
=============================
Page Attributes
=============================
<!--- Page Title --->
#$.content('title')#
<!--- Page Navigation Title --->
#$.content('menuTitle')#
<!--- Page Author/Credits --->
#$.content('credits')#
<!--- Dump All Page Values --->
<cfdump var="#$.content().getAllValues()#">
=============================
Create Dynamic CSS Hook
=============================
#$.createCSSHook($.content('menuTitle'))# <!--- Replace with any dynamic value you want --->
=============================
Breadcrumbs
=============================
<nav>#$.dspCrumbListLinks()#</nav>
=============================
Primary Navigation
=============================
#$.dspPrimaryNav(
viewDepth=1
, id='navPrimary'
, class='nav navbar-nav'
, displayHome='always'
, closeFolders=true
, showCurrentChildrenOnly=false
, ulTopClass='nav navbar-nav'
, ulNestedClass='dropdown-menu'
, liHasKidsClass='dropdown'
, liHasKidsAttributes=''
, liHasKidsNestedClass='dropdown-submenu'
, liNestedClass=''
, aHasKidsClass='dropdown-toggle'
, aHasKidsAttributes='role="button" data-toggle="dropdown" data-target="##"'
, liCurrentClass=''
, aCurrentClass=''
, siteid=$.event('siteid')
)#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment