Last active
December 31, 2015 23:19
-
-
Save stevewithington/8059334 to your computer and use it in GitHub Desktop.
Mura CMS : Display a .swf file quickly and easily using this dspSWF() method. Drop it into your Site or Theme contentRenderer.cfc and it will be available via $.dspSWF().
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
<!--- | |
Add this to html_head.cfm | |
<script type="text/javascript" src="#$.siteConfig('assetPath')#/js/swfobject/swfobject.js"></script> | |
Example Usage: | |
#$.dspSWF(swf='#$.siteConfig('themeAssetPath')#/assets/yourfile.swf', width=680, height=100, objectID='your-file', wrapperID='your-file-wrapper')# | |
---> | |
<cffunction name="dspSWF" output="false" returntype="any"> | |
<cfargument name="swf" default="" /> | |
<cfargument name="width" default="100" /> | |
<cfargument name="height" default="100" /> | |
<cfargument name="objectID" default="#$.createCSSID(CreateUUID())#" /> | |
<cfargument name="minVersion" default="9" /> | |
<cfargument name="wrapperID" default="" /> | |
<cfset var local = {} /> | |
<cfset local.str = '' /> | |
<cfif Len(Trim(arguments.swf))> | |
<cfsavecontent variable="local.str"><cfoutput> | |
<script type="text/javascript"> | |
if ( 'swfobject' in window) { | |
swfobject.registerObject("#arguments.objectID#","#arguments.minVersion#","#$.siteConfig('assetPath')#/js/swfobject/expressInstall.swf"); | |
} | |
</script> | |
<div class="swf"<cfif Len(arguments.wrapperID)> id="#arguments.wrapperID#"</cfif>> | |
<object id="#arguments.objectID#" width="#Val(arguments.width)#" height="#Val(arguments.height)#"> | |
<param name="movie" value="#arguments.swf#" /> | |
<!--[if !IE]>--> | |
<object type="application/x-shockwave-flash" data="#arguments.swf#" width="#Val(arguments.width)#" height="#Val(arguments.height)#"> | |
<!--<![endif]--> | |
<p><a href="http://get.adobe.com/flashplayer/">Download Adobe Flash Player ></a></p> | |
<!--[if !IE]>--> | |
</object> | |
<!--<![endif]--> | |
</object> | |
</div> | |
</cfoutput></cfsavecontent> | |
</cfif> | |
<cfreturn local.str /> | |
</cffunction> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment