Referencing PHP from an ext JavaScript file

Richlad

New Member
I'm having some trouble trying to get my tweets on the header of my site using an ext PHP file, referenced from a JavaScript tag - I have included the header reference in the PHP file and output as last line is javascript encompassing the echo. \[code\]<?phpHeader("content-type: application/x-javascript");//Get Latest Tweetfunction latest_tweet($username,$tweetnumber){ $url = "http://search.twitter.com/search.atom?q=from:$username&rpp=10"; $xml = simplexml_load_file($url); $tweettitle = $xml->entry[$tweetnumber]->title; $mytweet = $xml->entry[$tweetnumber]->content; $firstChar = substr($tweettitle, 0, 1); //Exclude @ replies if($firstChar == "@"){ //If this tweet is an @ reply move on to the previous one while ($firstChar == "@"){ $tweetnumber++; $tweettitle = $xml->entry[$tweetnumber]->title; $mytweet = $xml->entry[$tweetnumber]->content; $firstChar = substr($tweettitle, 0, 1); if($firstChar != "@"){ //If the previous tweet is not an @ reply output it return $mytweet; } } } else { //If first tweet is not an @ reply output it return $mytweet; }}//End Get Latest Tweet//outputecho "document.write(latest_tweet('mikedeveloper', 0))";?>\[/code\]
 
Top