Created
June 24, 2014 16:41
-
-
Save ronnieduke/fcf64d2b4cac40db0303 to your computer and use it in GitHub Desktop.
Use the Mura Iterator with a custom query
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
<cfquery name="rsExample"> | |
SELECT content,siteID | |
FROM tcontent | |
WHERE ..... | |
</cfquery> | |
<cfset it=application.serviceFactory.getBean("contentIterator")> | |
<cfset it.setQuery(rsExample)/> | |
<!--- Now Iterate and pull attributes that aren't in the query ---> | |
<cfloop condition="it.hasNext()"> | |
<cfset item=it.next()> | |
<cfoutput> | |
#it.currentIndex()#: #item.getMenutitle()# - #item.getCustomVar()#</br> | |
</cfoutput> | |
</cfloop> | |
<!--- You can even set items in your iterator with new values ---> | |
<cfloop condition="it.hasNext()"> | |
<cfscript> | |
item=it.next(); | |
item.setIsNav(0); // turn off navigation | |
item.save() // save the content bean | |
</cfscript> | |
</cfloop> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment