[SWFObject] Using PHP with SWFObj

Geoff Stearns geoff at deconcept.com
Fri Dec 8 10:56:32 PST 2006


i'm gonna go with steve's guess and say that maybe your html isn't  
done right... maybe you are missing a closing div tag or something?

from the code you pasted it should be working fine - the blog name  
will always be printed by the php, and that's fine - and then when  
the swfobject code kicks in it will remove that html and replace it  
with the swf (but you'll always see the html when you view source,  
that's how js works)

can you post a link to the page? if not, maybe try running that page  
through the w3c validator to make sure you don't have any errors in  
your html.



On Dec 8, 2006, at 1:47 PM, Matt S. wrote:

> it works fine in most browsers, and it works fine in ALL if I remove
> the PHP code from flashcontent (as in your test below). In IE 6- is
> the only browser where I end up with the flash object appearing, but
> then the PHP-generated code appears below it.
>
> Is it possible that because the PHP code appears BEFORE the swfobject
> script, it gets processed as soon as the browser hits it, and then
> immediately afterwards the swfobject script does its thing as well and
> generates the flash?
>
> thanks,
>
> .m
>
> On 12/8/06, Steve Kamerman <kamermans at teratechnologies.net> wrote:
>> Maybe you've got another div or element with the id "flashcontent" or
>> something.  You said you that you can still see the text in the
>> flashcontent div - how?  wmode=transparent?  It should be completely
>> replaced - it's my understanding that SWFObject overwrites the  
>> innerHTML
>> of whatever div you specify (flashcontent), this would completely  
>> erase
>> the initial contents of the div.  Are you getting any Javascript  
>> errors
>> on the page?  Can you isolate the problem by making a new test  
>> page like
>> this?:
>>
>> <html><head></head><body>
>> <!--start flash header-->
>>                 <div id="flashcontent">
>>                 I should not see this
>>                 </div>
>>
>>         <script type="text/javascript">
>>                 // <![CDATA[
>>
>>                 var so = new
>> SWFObject("http://www.someurl.com/dir/flashheader.swf",
>> "header", "564", "150", "8", "#000000");
>>                 so.addParam("scale", "noscale");
>>                  so.addVariable("hdrtext", "This is a FlashVar");
>>                 so.write("flashcontent");
>>
>>                 // ]]>
>>         </script>
>>
>> <!--end flash header-->
>> </body></html>
>>
>> Also, I would recommend using a relative path to your SWF to  
>> prevent any
>> cross domain issues (i.e. /dir/flashheader.swf ).
>>
>> Good luck!
>>
>> Steve Kamerman
>> Director of IT
>> Tera Technologies
>>
>> -----Original Message-----
>> From: swfobject-bounces at lists.deconcept.com
>> [mailto:swfobject-bounces at lists.deconcept.com] On Behalf Of Matt S.
>> Sent: Friday, December 08, 2006 11:21 AM
>> To: swfobject at lists.deconcept.com
>> Subject: [SWFObject] Using PHP with SWFObj
>>
>> HI,
>> so I'm trying to integrate SWFObject into a Wordpress blog, and it's
>> been going fine, except for in IE (imagine that). I have the  
>> following
>> content:
>>
>> <!--start flash header-->
>>                 <div id="flashcontent">
>>                 <?php bloginfo('name'); ?>
>>                 </div>
>>
>>         <script type="text/javascript">
>>                 // <![CDATA[
>>
>>                 var so = new
>> SWFObject("http://www.someurl.com/dir/flashheader.swf",
>> "header", "564", "150", "8", "#000000");
>>                 so.addParam("scale", "noscale");
>>                  so.addVariable("hdrtext", "<?php bloginfo('name');
>> ?>");
>>                 so.write("flashcontent");
>>
>>                 // ]]>
>>         </script>
>>
>> <!--end flash header-->
>>
>>
>> And its working great, its passing in the blog name as a variable,  
>> but
>> the problem is that in IE  6 and older, the "<?php bloginfo('name');
>> ?>" thats in "flashcontent", and should be appearing only if flash
>> isnt present, is getting processed anyway, so what you end up with is
>> the flash object generated, but then under it the content  
>> generated by
>> the php gets inserted as well.
>>
>> The basic goal is that if flash is present, show the flash, and if  
>> its
>> not, run the PHP as Wordpress normally would. In this case though, in
>> IE 6, its doing both.
>>
>> Any suggestions much appreciated,
>>
>> thanks!
>>
>> ..m
>> _______________________________________________
>> SWFObject mailing list
>> SWFObject at lists.deconcept.com
>> http://lists.deconcept.com/listinfo.cgi/swfobject-deconcept.com
>>
>> _______________________________________________
>> SWFObject mailing list
>> SWFObject at lists.deconcept.com
>> http://lists.deconcept.com/listinfo.cgi/swfobject-deconcept.com
>>
> _______________________________________________
> SWFObject mailing list
> SWFObject at lists.deconcept.com
> http://lists.deconcept.com/listinfo.cgi/swfobject-deconcept.com




More information about the Swfobject mailing list