mileslevi Posted November 30, 2008 Share Posted November 30, 2008 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> Quote Link to comment https://forums.phpfreaks.com/topic/134884-mass-page-edit/ Share on other sites More sharing options...
DeanWhitehouse Posted November 30, 2008 Share Posted November 30, 2008 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> Quote Link to comment https://forums.phpfreaks.com/topic/134884-mass-page-edit/#findComment-702350 Share on other sites More sharing options...
DarkWater Posted November 30, 2008 Share Posted November 30, 2008 I think a better question is why are you making a thousand pages when you can just have a single PHP page that serves up the content? =/ Quote Link to comment https://forums.phpfreaks.com/topic/134884-mass-page-edit/#findComment-702352 Share on other sites More sharing options...
mileslevi Posted November 30, 2008 Author Share Posted November 30, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/134884-mass-page-edit/#findComment-702411 Share on other sites More sharing options...
DeanWhitehouse Posted November 30, 2008 Share Posted November 30, 2008 If you can use a DB to store all the file details then you can use $_GET[]; to view specific files. Quote Link to comment https://forums.phpfreaks.com/topic/134884-mass-page-edit/#findComment-702413 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.