Last active
December 18, 2015 08:59
-
-
Save lxcodes/5757699 to your computer and use it in GitHub Desktop.
Mura CMS Basic CFScript Content Iterator from Local Content Index
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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