REMOVE THE EXTENSION FROM THE .SWF FILE NAME IF YOU”RE USING THE “JAVA RUN CONTENT” SCRIPT - Aug 3rd, 2010


User The Seen needed to be able to pull in the url link or flash name into the Java script code but need to remove the
extension (ie: .swf) form the end.

Here’s the embedded code that The Seen was using:



<?php foreach ($your_tableRecord['your_field'] as $upload): ?>
<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['urlPath']?>','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgcolor','#181818','movie','<?php
echo $upload['urlPath']?>' );
</script>
<?php endforeach ?>



Here’s the solution provided by Dave from Interactive Tools. He said:

Just put:



<?php $upload['urlPathNoExt'] = preg_replace('/\.\w+$/', '', $upload['urlPath']); ?>



inside the foreach loop but above where you want to use it.

Then display it like this:



<?php echo $upload['urlPathNoExt'] ?>



So the result would be:



<?php foreach ($your_tableRecord['your_field'] 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']?>' );
</script>
<?php endforeach ?>




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