Skip to content

Instantly share code, notes, and snippets.

@jsieber
Created November 5, 2014 20:06
Show Gist options
  • Save jsieber/7c31556ff6bf6309e7ce to your computer and use it in GitHub Desktop.
Save jsieber/7c31556ff6bf6309e7ce to your computer and use it in GitHub Desktop.
Update Display, Nav and Search Exclude attributes in child pages
<cfoutput>
<!--- Read out an existing node from the default site.--->
<cfset contentBean=application.contentManager.getActiveContent('59280367-A98E-4F7D-B4463B3E405054FD','default')>
<!--- Pull out a content iterator of the nodes child content (all underlying pages within a given node).--->
<cfset it=contentBean.getKidsIterator(liveOnly='false') />
<!--- The number of Items to be listed is determined by the content.getNextN() value. Its default is 10. --->
<cfset it.setPage(1)>
<!--- You can also set the start row instead of setting a page number. --->
<cfset it.setStartRow(1)>
<cfloop from="1" to="#it.pageCount()#" index="p">
<cfset it.setPage(p)>
<cfloop condition="#it.hasNext()#">
<cfset childcontentBean = it.next() />
<cfset childcontentBean.setDisplay(1) />
<cfset childcontentBean.setisNav(1) />
<cfset childcontentBean.setsearchExclude(0) />
<cfset childcontentBean.save() />
<cfif not structIsEmpty(childContentBean.getErrors())>
<cfdump var="#childContentBean.getErrors()#"> <br />
</cfif>
#childcontentBean.getfilename()# has been turned on!<br />
</cfloop>
</cfloop>
</cfoutput>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment