Jump to content

[SOLVED] Echo echos extra character


soycharliente

Recommended Posts

I wrote this little thing ...
[code]<?php $rss = fetch_rss('http://www.example.com/feed');
foreach ( $rss->items as $item ) {
echo " <a href=\"{$item['link']}\" title=\"{$item['title']}\">" . $item['title'] . "</a>";
break;
} ?>[/code]

to go the the URL provided and grab the RSS feed and echo out the first post. It works perfectly except the link doesn't work. It renders as a link, blue and underlined, but when you put your mouse over, the text selecting cursor remains. It doesn't change to a hand like normals links do. I open the source code and find this...

[code]<a xhref="http://www.example.com/feed/Post+Title" title="Post Title">Post Title</a>[/code]

Notice the "xhref" in there. The code does not contain the 'x', but when the HTML is echoed out it shows up. Has anyone EVER seen this before? ANY help is very much appreciated.

EDIT: I should probably add that 'fetch_rss' is obviously not a basic function, but rather one that I wrote as well.
Link to comment
https://forums.phpfreaks.com/topic/27624-solved-echo-echos-extra-character/
Share on other sites

I've noticed before, when using TinyMCE in a project, manually typing HTML into it causes issues like this. I'm not sure if it is some kinda protection against users adding in rogue code or what, but I fix it at the output stage with some str_replace() 's. Either that, or check the documentation for a switch that disables this 'feature'.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.