Page 1 of 1

Loading Flash from PHP

Posted: Fri Apr 16, 2010 2:34 am
by thirteen
Hi I have the following script:

Code: Select all

<?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 ... kwaveFlash" type="application/x-shockwave-flash" width="746" height="235">

Any suggestions?

Re: Loading Flash from PHP

Posted: Fri Apr 16, 2010 5:12 am
by roders
Replace what you currently have with.

Code: Select all

<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 addslashes($row["value"]); ?>" />
          <param name="quality" value="high" />
          <embed src="<?php echo addslashes($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>