Skip to content

Instantly share code, notes, and snippets.

@howellcc
Last active September 18, 2015 17:34
Show Gist options
  • Save howellcc/167bc9f75702571d3811 to your computer and use it in GitHub Desktop.
Save howellcc/167bc9f75702571d3811 to your computer and use it in GitHub Desktop.
[MuraCMS] - Public display of a plugin's display object with fallback.
<!--- In this example, MuraTweets is a plugin and TwitterTile is one of its display objects.
In my experience, this method of referencing the display will fail once in a blue moon. Usually
fixable by simply doing an application reload. This snippet supplies a fallback in case, for some
reason, the plugin isn't registered within the MuraScope. --->
<cftry>
#$.MuraTweets.TwitterTile($)#
<cfcatch type="any">
<cfset qryDisplayObjects = application.pluginManager.getDisplayObjectsBySiteID(siteID=$.event('siteID'))>
<cfquery name="muraTweetsTwitterTile" dbtype="query">
select * from qryDisplayObjects
where displayMethod = 'TwitterTile'
</cfquery>
<cfif muraTweetsTwitterTile.recordCount eq 1>
#$.dspObject(object="plugin",objectID=muraTweetsTwitterTile.objectID)#
</cfif>
</cfcatch>
</cftry>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment