MAKING AN SWF DISPLAY LIKE AN IMAGE - Dec 29th, 2018


Dave Edis from Interactive Tools says that the first step is to figure out what HTML you want inserted for swf files.
You can find details about that here:
http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_4150 .

Next, If you know you're _only_ going to be uploading swf files in that upload field you can hard code it to always show
uploads with your swf html like this:


<?PHP foreach ($newsRecord['uploads'] as $upload): ?>
<embed src="<?PHP echo $upload['urlPath?>" ... /><br />
<?PHP endforeach ?>


Or if you're going to have images and swf in the same field you can test the file extension to figure out what html to
insert for each upload:


<?PHP foreach ($newsRecord['uploads'] as $upload): ?>
<?PHP if ($upload['extension'] == 'swf'): ?>
... your html code for swf files ...
<?PHP elseif ($upload['hasThumbnail']): ?>
... html code for thumbnails ...
<?PHP elseif ($upload['isImage']): ?>
...your html codes for images (if there is no thumbnail) ...
<?PHP else: ?>
... your html code for other file types (this could be a download link) ...
<?PHP endif; ?>
<?PHP endforeach ?>


If you’re using a Java Run Content script you’ll need to pull in the url link or flash name into the Java script
code without the .swf extension.

Here how:


<?PHP foreach ($your_sectionRecord['your_field_name'] as $upload): ?>
<?PHP $upload['urlPathNoExt'] = preg_replace('/\.\w+$/', '', $upload['urlPath']); ?> <script type="text/javascript">
AC_FL_RunContent(
'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','960','height','362','src','<?PHP
echo $upload['urlPathNoExt'] ?>
','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgcolor','#181818','movie','<?PHP
echo $upload['urlPathNoExt'] ?> ' ); //end AC code
</script>


How does it work?

The <?PHP $upload['urlPathNoExt'] = preg_replace('/\.\w+$/', '', $upload['urlPath']); ?> code is what strips the .swf
extension from the field results. Dave says that you need to put that inside the foreach loop, but above where you want
to use it. You’d then display the new url path without the extension with <?PHP echo $upload['urlPathNoExt'] ?>



The materials on this web site have been created for use with CMS Builder content management software. CMS Builder software is published and licensed for use by InteractiveTools.com. Please contact Interactive Tools for information on the downloading of the software or the purchasing of licenses.


Terms of Service