Jump to content

Loading Flash from PHP


thirteen13

Recommended Posts

Hi I have the following script:

 

<?php
$table = 'web_site_content';
$tableVars = 'web_site_tmplvar_contentvalues';

$id = $modx->documentObject['id'];

$sql = "Select * from $tableVars where contentid = $id and tmplvarid = 2";
$result = $modx->db->query($sql); 
if($row = $modx->db->getRow($result)) 
{	
?>
    <div id="banner">
<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="746" height="235">
  <param name="movie" value="<?php echo $row["value"]; ?>" />
  <param name="quality" value="high" />
  <embed src="<?php echo $row["value"]; ?>" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="746" height="235"></embed>
</object>
    </div>
<?php
}
else
{
$sql = "Select * from $tableVars where contentid = $id and tmplvarid = 1";
$result = $modx->db->query($sql); 
if($row = $modx->db->getRow($result)) 
{	
	echo'<div id="banner"><img src="'.$row["value"].'" width="746" height="235" /></div>';
}
}
?>

 

Basically it checks whether there is a flash banner uploaded and loads it into a div. If there isn't a flash banner uploaded then it loads the image.

 

The image loads without a problem when there isn't a flash item, but when there is a flash item, instead of the flash item, it loads the following error message:

 

 

" /> " quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="746" height="235">

 

Any suggestions?

Link to comment
https://forums.phpfreaks.com/topic/198723-loading-flash-from-php/
Share on other sites

I have tried your suggestion. My snippet now looks like this:

 

    <div id="banner">
    <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="746" height="235">
      <param name="movie" value="<?php echo htmlspecialchars($row["value"]); ?>" />
      <param name="quality" value="high" />
      <embed src="<?php echo htmlspecialchars($row["value"]); ?>" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="746" height="235"></embed>
    </object>
    </div>

 

but it still shows the same error as before  :confused:

Well iI just tried this:

<?php
$row = 1;
if($row = 1) 
{	
?>
    <div id="banner">
<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="746" height="235">
  <param name="movie" value="" />
  <param name="quality" value="high" />
  <embed src="" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="746" height="235"></embed>
</object>
    </div>
<?php
}
else
{

	echo'<div id="banner"><img src="site.jpg" width="746" height="235" /></div>';

}
?>

 

And it works fine?.. Try it yourself.

In your code, top two lines make no sense.. especially second line - assignment instead of comparing :)

 

Well iI just tried this:

<?php
$row = 1;
if($row = 1) 
{	
?>
    <div id="banner">
<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="746" height="235">
  <param name="movie" value="" />
  <param name="quality" value="high" />
  <embed src="" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="746" height="235"></embed>
</object>
    </div>
<?php
}
else
{

	echo'<div id="banner"><img src="site.jpg" width="746" height="235" /></div>';

}
?>

 

And it works fine?.. Try it yourself.

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.