Skip to content

Instantly share code, notes, and snippets.

@ronnieduke
Last active August 29, 2015 14:03
Show Gist options
  • Save ronnieduke/669d596c7f2d4066429c to your computer and use it in GitHub Desktop.
Save ronnieduke/669d596c7f2d4066429c to your computer and use it in GitHub Desktop.
Create bulk updates in Mura such as setting items to display, or show in nav
<!---
Place this file in your theme remote folder
--->
<cfscript>
// add the content ID of the folder you wish to loop through and turn on
itemID=''
content=$.getBean('content').loadBy(contentID=itemID);
// Only get the feed if it's a valid node
if ( not content.getIsNew()){
// Create a feed
feed=$.getBean('feed');
feed.setContentID(itemID);
feed.setNavOnly(0);
feed.setLiveOnly(0);
//get the iterator
it=feed.getIterator();
}
else{
writeOutput("Invalid Content ID");
abort;
}
</cfscript>
<!--- Loop through each item in the feed and set it's display to 'yes' --->
<cfif it.hasNext()>
<cfloop condition="it.hasNext()">
<cfset item=it.next()>
<cfset item.setDisplay(1)>
<cfset item.setIsNav(1)>
<cfset item.save()>
</cfloop>
</cfif>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment