6 Replies - 1727 Views - Last Post: 04 December 2012 - 11:35 PM Rate Topic: -----

#1 g37752  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 195
  • Joined: 24-July 12

html_entity_decode?

Posted 03 December 2012 - 05:44 PM

I use php to read and write out html code, but it contains "&""#038"; which I suspect is what makes flash player not work (in IE, although it works on Firefox)?

document.write('<embed src="adv/focus.swf" wmode="opaque" FlashVars="config='+config+'&bcastr_flie=....


in the above code, the ampersand is replaced with (ampersand #038 semi-colon), when i view page source.

I tried to get rid of (ampersand #038 semi-colon) using str_replace (to replace it with &), and html_entity_decode, but nothing happened?

when i type in the code here, it will automatically be converted into a single ampersand, if i use firefox. If i use IE, I cannot even view this page..?

This post has been edited by g37752: 03 December 2012 - 06:18 PM


Is This A Good Question/Topic? 0
  • +

Replies To: html_entity_decode?

#2 goku87  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 4
  • View blog
  • Posts: 77
  • Joined: 17-October 09

Re: html_entity_decode?

Posted 03 December 2012 - 06:47 PM

I need to see the code to be able to tell what is going on in it, such as the order you are decoding and str_replacing. I suspect that may be part of the issue.
Was This Post Helpful? 0
  • +
  • -

#3 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3719
  • View blog
  • Posts: 5,991
  • Joined: 08-June 10

Re: html_entity_decode?

Posted 03 December 2012 - 06:53 PM

Could you show us the PHP code?

I'm not much of a Flash person, but I believe <embed> is a deprecated Netscape tag and only works in some browsers (including Mozilla based browsers, if I am not mistaken.) The cross-browser solution is to use <object> instead. See the following article:
A List Apart: Flash Satay: Embedding Flash While Supporting Standards
Was This Post Helpful? 0
  • +
  • -

#4 g37752  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 195
  • Joined: 24-July 12

Re: html_entity_decode?

Posted 03 December 2012 - 07:57 PM

cURL to read contents..
$content=iconv('gb2312','utf-8',curl_exec($ch));
echo $content;


in the HTML the php code writes out:

<script type="text/javascript">
  var swf_width=290;	 
  var swf_height=198;
  var config='5|0xffffff|0x0099ff|50|0xffffff|0x0099ff|0x000000';
  var files='images/Upfile/2012-8/2012833572481023.jpg|images/Upfile/2012-8/20128343070795.jpg|images/Upfile/2012-8/2012832301660619.jpg|images/Upfile/2012-8/2012832312594527.jpg|images/Upfile/2012-8/2012832315110772.jpg';
  var links='Thread.asp?tid=598|Thread.asp?tid=598|Thread.asp?tid=596|Thread.asp?tid=596|Thread.asp?tid=596';
  var texts='...';
   document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ swf_width +'" height="'+ swf_height +'">'); 
  document.write('<param name="movie" value="adv/focus.swf" />'); 
  document.write('<param name="quality" value="high" />');
  document.write('<param name="menu" value="false" />');
  document.write('<param name=wmode value="opaque" />');
  document.write('<param name="FlashVars" value="config='+config+'&bcastr_flie='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'" />');
  document.write('<embed src="adv/focus.swf" wmode="opaque" FlashVars="config='+config+'&bcastr_flie='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'" menu="false" quality="high" width="'+ swf_width +'" height="'+ swf_height +'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
  document.write('</object>'); </script>


in the last 5 lines, all ampersands (&) show up as (ampersand #038 semi-colon)

this HTML works on Firefox, not IE.

This post has been edited by g37752: 03 December 2012 - 07:58 PM

Was This Post Helpful? 0
  • +
  • -

#5 g37752  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 195
  • Joined: 24-July 12

Re: html_entity_decode?

Posted 03 December 2012 - 10:58 PM

i think i have confirmed that its (ampersand #038 semi-colon) thats causing my problems. I manually write the javascript code into HTML (while changing the code "(ampersand #038 semi-colon)" to ampersand) and it works.

i see php echos the simple ampersand, but when it comes into a browser, it turns into #038?? the html header :

<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head>

This post has been edited by g37752: 03 December 2012 - 11:44 PM

Was This Post Helpful? 0
  • +
  • -

#6 g37752  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 195
  • Joined: 24-July 12

Re: html_entity_decode?

Posted 04 December 2012 - 08:01 PM

unable to use html_entity_decode($content), I tried to use strpos to grab the sub strings before and after the ampersand, while adding in between

html_entity_decode("+`&")


it still comes out #038.

there are other ampersnad#8211, etc, and they all come out right in my browser.. whats with #038??

somebody help?
Was This Post Helpful? 0
  • +
  • -

#7 g37752  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 195
  • Joined: 24-July 12

Re: html_entity_decode?

Posted 04 December 2012 - 11:35 PM

Sorry, got it all wrong.

the problem was document.write does not work in xhtml. solved.

thanks.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1