Skip to content

Instantly share code, notes, and snippets.

@stevewithington
Created November 29, 2012 18:13
Show Gist options
  • Save stevewithington/4170872 to your computer and use it in GitHub Desktop.
Save stevewithington/4170872 to your computer and use it in GitHub Desktop.
Mura CMS: Category Iterator Examples
<cfscript>
// Category Iterator of Children of the Current Content Node
itKidsCats = $.content().getKidsCategoryIterator();
// Category Iterator of the CURRENT Content Node
itCats = $.content().getCategoriesIterator();
</cfscript>
<cfoutput>
<!--- Children of the Current Content Node --->
<h4>Kids Categories</h4>
<cfif itKidsCats.hasNext()>
<ul>
<cfloop condition="itKidsCats.hasNext()">
<cfset kidItem = itKidsCats.next()>
<li>#HTMLEditFormat(kidItem.getName())#</li>
</cfloop>
</ul>
<cfelse>
<p><em>This content either has NO children, OR none of its children have been categorized.</em></p>
</cfif>
<!--- CURRENT Content Node --->
<h4>Current Content Node's Categories</h4>
<cfif itCats.hasNext()>
<ul>
<cfloop condition="itCats.hasNext()">
<cfset thisItem = itCats.next()>
<li>#HTMLEditFormat(thisItem.getName())#</li>
</cfloop>
</ul>
<cfelse>
<p><em>This content has NOT been categorized.</em></p>
</cfif>
</cfoutput>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment