Jump to content

Mass Page Edit


mileslevi

Recommended Posts

Hey everyone. Thanks for any help in advance!

 

The Question: I have a directory with about 1000 swf flash files. I used the following script to create a page for each file:

 

<?php

 

$ext = 'mp3';

$path = 'swf/*.swf';

$outdir = '.';

 

$glob = glob($path);

foreach ($glob as $file) {

$file = basename($file);

$fname_noext = preg_replace("/\.$ext$/", '', $file);

$title = ucwords(str_replace('_', ' ', $fname_noext));

$fname = $outdir . '/' . strtolower($fname_noext) . '.php';

ob_start();

include 'template.php';

$html = ob_get_contents();

ob_end_clean();

if (!$fp = @fopen($fname, 'w')) {

print "Unable to create $fname. ";

print "Please check the permissions of '$outdir'\n";

continue;

} else {

fputs($fp, $html);

fclose($fp);

print "Successfully created $fname\n";

}

}

 

?>

 

It outputs file.swf.php.

I need a way to make the flash object in file.swf.php (template.php) to point to each differnet corresponding to the flash file. Get it? Tried my best to explain.

 

I tried this below but it didnt work:

 

  <script type="text/javascript">

AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','586','height','447','src','../$fname_noext','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','../$fname_noext' ); //end AC code

</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="586" height="447">

                  <param name="movie" value="$fname_noext" />

                  <param name="quality" value="high" />

                  <embed src="$fname_noext" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="586" height="447"></embed>

                </object></noscript>

Link to comment
https://forums.phpfreaks.com/topic/134884-mass-page-edit/
Share on other sites

First off use code tags for any code, and second off


  <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','586','height','447','src','../$fname_noext','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','../$fname_noext' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="586" height="447">
                  <param name="movie" value="$fname_noext" />
                  <param name="quality" value="high" />
                  <embed src="$fname_noext" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="586" height="447"></embed>
                </object></noscript>

should it not be


  <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','586','height','447','src','../<?php echo $fname_noext;?>','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','<?php echo "../".$fname_noext;?>' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="586" height="447">
                  <param name="movie" value="<?php echo $fname_noext;?>" />
                  <param name="quality" value="high" />
                  <embed src="<?php echo $fname_noext;?>" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="586" height="447"></embed>
                </object></noscript>

Link to comment
https://forums.phpfreaks.com/topic/134884-mass-page-edit/#findComment-702350
Share on other sites

Thanks Blade280891 that worked but now the script isnt creating all the pages just about 30. Thought maybe execution time so i changed it but didnt work.

 

Can anyone think of a more effeicent way to do this (DarkWater) it would be much apprciated. I need to use php for this site but thats not my scripting of choice.

Link to comment
https://forums.phpfreaks.com/topic/134884-mass-page-edit/#findComment-702411
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.