Skip to content

Instantly share code, notes, and snippets.

@pauldenato
Last active August 29, 2015 14:13
Show Gist options
  • Save pauldenato/9ddf07f92ba159a34d0b to your computer and use it in GitHub Desktop.
Save pauldenato/9ddf07f92ba159a34d0b to your computer and use it in GitHub Desktop.
Get all Display Objects
<!--- //Drop this in the theme or site contentrenderer.cfc --->
<cffunction name="getPageDisplayObjects" output="no" returntype="query">
<cfargument name="ContentHistID" required="yes">
<cfargument name="siteID" required="no">
<cfset getDisplayObjects = '' />
<cfquery name="getDisplayObjects" datasource="#application.configBean.getDatasource()#">
select ContentHistID,ObjectID,Object,ContentID,Name,OrderNo,SiteID,ColumnID,Params
from tcontentobjects
where ContentHistID = <cfqueryparam cfsqltype="cf_sql_varchar" value="#trim(arguments.ContentHistID)#" /> and
SiteID = <cfqueryparam cfsqltype="cf_sql_varchar" value="#trim(arguments.siteID)#" />
</cfquery>
<cfreturn getDisplayObjects>
</cffunction>
<!--- //Place this in a template or dsp_getTheObjects.cfm and then a component. --->
<cfset qryTheObjects = $.getPageDisplayObjects($.content('contentHistID'),$.content().getValue('siteid')) />
<cfloop query="qryTheObjects">
<!---<cfif qryTheObjects.name contains '{object name}'>--->
<!---conditional code here--->
#qryTheObjects.name#
<!---</cfif> --->
</cfloop>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment