php - Do I need to format a twitter status before outputing it to a web page? -



php - Do I need to format a twitter status before outputing it to a web page? -

so, looking @ how other web pages have sorted out, , found http://www.phppennyauctiondemo.com/ (below auctions, there's twitter updates part).

they format twitter statuses next way before outputing web page:

<script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"> ... var status = twitters[i].text.replace(/((https?|s?ftp|ssh)\:\/\/[^"\s\<\>]*[^.,;'">\:\s\<\>\)\]\!])/g, function(url) { homecoming '<a href="'+url+'">'+url+'</a>'; }).replace(/\b@([_a-z0-9]+)/ig, function(reply) { homecoming reply.charat(0)+'<a href="http://twitter.com/'+reply.substring(1)+'">'+reply.substring(1)+'</a>'; }); ... </script>

my question is: why? , do?

also, should aswell? until now, i've used twitters[i].text. without formating.

replace(/((https?|s?ftp|ssh)\:\/\/[^"\s\<\>]*[^.,;'">\:\s\<\>\)\]\!])/g, function(url) { homecoming '<a href="'+url+'">'+url+'</a>'; })

this makes urls in tweet clickable addind <a> tag around them.

replace(/\b@([_a-z0-9]+)/ig, function(reply) { homecoming reply.charat(0)+'<a href="http://twitter.com/'+reply.substring(1)+'">'+reply.substring(1)+'</a>'; })

this makes @names clickable adding <a> tag around them, allows people reply tweet.

you can skip formatting, displaying unclickable urls users not usability practice. ability click on tweet author's name convenient too.

php jquery twitter

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -