View Full Version : html tags in output
gurmeet
10-11-2010, 08:07 AM
i am using a nl2br tag...
nl2br($text)
but in text there are somr <img> tags... in output nl2br method convert <img> to special chars...
instead of showing me pictur for img tag it just displays a <img> tag with full source.....
what to do..?
nl2br() doesn't do that... are you sure you don't have something like htmlentities() running at another point in your script?
bluewalrus
10-11-2010, 03:06 PM
If you view the souce does it say <img ... >?
We'd need to see your code for a more detailed answer.
Actually if you have "new lines"(\n or\r) in your source code i guess this code occur as well because it would write it as
<img <br /> src="" />
but that would display on more than 1 line. So seeing the actual source of the output could help as well as the code.
gurmeet
10-12-2010, 04:54 AM
no i never used the function line htmlentities
yes my out put code is lying here...
<img src='img/smilies/icon_e_biggrin.gif'> <br />
<img src='img/smilies/icon_eek.gif'> <br />
<img src='img/smilies/icon_razz.gif'> <br />
<img src='img/smilies/icon_e_surprised.gif'>ops: <br />
<img src='img/smilies/icon_e_confused.gif'>: <br />
<img src='img/smilies/icon_cry.gif'> <br />
i only used the nl2br function
I have no idea. I've tested
<?php
$tag = '<img src="test.jpg">'."\n";
echo nl2br($tag);
?>locally and on two different live servers, each time I got
<img src="test.jpg"><br />
gurmeet
10-12-2010, 07:03 AM
ok.. leave it what nl2br does....
is ther any method to convert such symbols to proper <img > tag?
bluewalrus
10-12-2010, 01:21 PM
htmlspecialchars_decode();
I'd try and find what it is being converted though.
absolutely, otherwise, you might not catch it at the right spot; or it could happen again somewhere
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.