Nested hyperlinks in XHTML 1.1 document
Posted
by Nazgulled
on Stack Overflow
See other posts from Stack Overflow
or by Nazgulled
Published on 2010-04-01T21:26:27Z
Indexed on
2010/04/01
21:33 UTC
Read the original article
Hit count: 297
Hi,
I'm doing a simple widget for WordPress that fetches the most recent tweets from the RSS feed provided by Twitter.
This widget parses any link posted on a tweet, it also parses mentions (ie: @username) and trending topics (ie: #nowplaying). For these 3 situations, it creates links pointing to some Twitter feature.
For instance:
"Hi @UserA, check out the song Foo from FooBar that I'm listening,
it's awesome. #nowplaying"
And it will parse into this:
Hi <a href="http://twitter.com/UserA">@UserA</a>, check out the song
Foo from FooBar that I'm listening, it's awesome.
<a href="http://twitter.com/#search?q=nowplaying">#nowplaying</a>
Now now I need to add a global link to the whole message, like this:
<a href="http://twitter.com/UserA/statuses/1234567890">
Hi <a href="http://twitter.com/UserA">@UserA</a>, check out the song
Foo from FooBar that I'm listening, it's awesome.
<a href="http://twitter.com/#search?q=nowplaying">#nowplaying</a>
</a>
But this code does not validate and it doesn't work anyways (the browsers don't really seem to know what to do with it).
Any suggestions how could I fix this?
© Stack Overflow or respective owner