Skip to content

Instantly share code, notes, and snippets.

@lxcodes
Last active December 18, 2015 08:59
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lxcodes/5757699 to your computer and use it in GitHub Desktop.
Save lxcodes/5757699 to your computer and use it in GitHub Desktop.
Mura CMS Basic CFScript Content Iterator from Local Content Index
<cfscript>
// Grab local content index (feed) by name. I believe siteid is optional, but I have always included it.
var feed = application.feedManager.readByName('Banners', $.event("siteid"));
// Create a content iterator from the feed.
var banners = feed.getIterator();
// HTML to add to.
var html = "";
// If the feed has actual items.
if(banners.getRecordCount()){
// While the feed has more items to iterate.
while(banners.hasNext()){
// Set banner to next item in the feed.
banner = banners.next();
// Build HTML Up
html &= '<img src="' & banner.getImageURL() & '">';
}
}
// Write HTML to page
writeOutput(html);
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment