Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mattlevine/a437fa3fe2964c138bef96a5be02e83d to your computer and use it in GitHub Desktop.
Save mattlevine/a437fa3fe2964c138bef96a5be02e83d to your computer and use it in GitHub Desktop.
Mura CMS: Custom primary navigation with primary associated images as links.
<!--- Mura 6.2 Syntax (will work in 7.0 as well) --->
<cfset it = $.getBean('feed').addParam(relationship='AND', field='parentid', condition='EQ', criteria='00000000000000000000000000000000001').getIterator() />
<!--- Mura 7.0 Syntax --->
<!--- <cfset it = $.getBean('feed').where().prop('parentid').isEQ('00000000000000000000000000000000001').getIterator() /> --->
<cfif it.hasNext()>
<ul>
<cfloop condition="it.hasNext()">
<cfset item = it.next() />
<li>
<a href="#item.getURL()#">
<cfif item.hasImage()>
<img src="#item.getImageURL('small')#" alt="#esapiEncode('html_attr', item.get('menutitle'))#" />
<cfelse>
#esapiEncode('html', item.get('menutitle'))# <!--- This item does not have a primary image --->
</cfif>
</a>
</li>
</cfloop>
</ul>
</cfif>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment