views:

114

answers:

3

I have tried to embed a flash movie in a zend view using the htmlFlash helper.

In theory you only have to pass the movie path to the htmlFlash helper in a phtml view:

 echo $this->htmlFlash('/path/to/myMovie.swf');

And the framework will generate the html code in the html page:

  <object data="/path/to/flash.swf"
          type="application/x-shockwave-flash"
          classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
          codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"&gt;
  </object>

However, I have done so and the code doesn't appear on the source code.

Has anyone had this problem?

Thank you

A: 

Try to set width and height:

<?php echo $this->htmlFlash(
    $this->baseUrl('/gfx/flash.swf'),
    array('width' => 700, 'height' => 200)
    );
?>

Remember to check, if Adblock does not hide the actual element :)

takeshin
takeshin, this didn't work for me and gives a php error.
curro
takeshin I've seen you've changed your comment but still your code doesn't work for me. What's the '$this->' doing there? Shouldn't it be just '/gfx/flash.swf'? Is there something I have to do in the controller? I just have an empty indexAction function.Thanks again
curro
I get:Parse error: syntax error, unexpected '(', expecting T_STRING or T_VARIABLE or '{' or '$'
curro
SO post editor should have embeded PHP syntax checker ;)
takeshin
What's SO?I'm beginning to think I'm too much of a newbie to embed flash or to the ZF altogether!Anyway I will never surrender ;-)
curro
StackOverflow :) There is no magic with htmlFlash(). Just follow the manual: http://framework.zend.com/manual/en/zend.view.helpers.html
takeshin
See this bug: http://framework.zend.com/issues/browse/ZF-4331 Maybe you are using Firefox 3.0.1 too?
takeshin
I'm using firefox 3.5.8 so there shouldn't be any problem. I have also tried with IE,as they suggest in the bug report you mention but to no avail. I don't get error messages when I use the code I posted first but the embedding tags don't appear in the source code view.It may have something to do with my apache configuration.However I have successfully completed the official ZF Quickstart and adapted the code in the book "ZF in action" to work with ZF 1.10 but curiously enough embedding flash eludes me.Thank you again, takeshin. I feel I'm taking too much of your time!
curro
Hey takeshin, it finally works! I have created a new ZF site with ZF tool and added your last code to the index.phtml file and I have the swf in place. Before I was trying in another local site I've been working on. So it seems there must be something wrong with it, though it works!Thanks, thanks, thanks
curro
A: 

90% chance you missed to ECHO the result. (= you wrote <?php $this->htmlFlash(...);?>)

Tomáš Fejfar
Hi tomas, I did write the echo statement. Only it doesn't appear in the post.
curro
A: 

I got the same problem:( It works in one project, but not in the one I need it. What can be the difference between them?

[EDIT] OK, I found the answer! In the public folder where my .swf files are located, I had
to add a .htaccess file with this one line: RewriteEngine On

jawaka