J'affiche un flux Twitter sur ma page d'accueil:
http://www.fairwaterrights.com
La nourriture fonctionne bien. Mais si je clique sur un lien dans le post Twitter, il ne s'ouvre pas.
Par exemple, au lieu d'ouvrir http://bit.ly/lNWyT9
dans le navigateur, il tente d'ouvrir http://www.fairwaterrights.com/%22http:/bit.ly/lNWyT9%22
.
Comment puis-je réparer cela? Voici le code:
<?php
$username = "fairwaterrights"; // Your Twitter username.
$limit = "4"; // Number of tweets to pull in.
/* These prefixes and suffixes will display before and after the entire block of tweets. */
$prefix = ""; // Prefix - some text you want displayed before all your tweets.
$suffix = ""; // Suffix - some text you want displayed after all your tweets.
$tweetprefix = "@fairwaterrights "; // Tweet Prefix - some text you want displayed before each Tweet.
$tweetsuffix = "<br><br>"; // Tweet Suffix - some text you want displayed after each Tweet.
$feed = "http://search.Twitter.com/search.atom?q=from:" . $username . "&rpp=" . $limit;
function parse_feed($feed, $prefix, $tweetprefix, $tweetsuffix, $suffix) {
$feed = str_replace("<", "<", $feed);
$feed = str_replace(">", ">", $feed);
$clean = explode("<content type=\"html\">", $feed);
$amount = count($clean) - 1;
echo $prefix;
for ($i = 1; $i <= $amount; $i++) {
$cleaner = explode("</content>", $clean[$i]);
echo $tweetprefix;
echo $cleaner[0];
echo $tweetsuffix;
}
echo $suffix;
}
$twitterFeed = file_get_contents($feed);
parse_feed($twitterFeed, $prefix, $tweetprefix, $tweetsuffix, $suffix);
?>
Merci de votre aide!
Essayez ceci. J'ai parcouru et remplacé "
par '
/* These prefixes and suffixes will display before and after the entire block of tweets. */
$prefix = ""; // Prefix - some text you want displayed before all your tweets.
$suffix = ""; // Suffix - some text you want displayed after all your tweets.
$tweetprefix = "@fairwaterrights "; // Tweet Prefix - some text you want displayed before each Tweet.
$tweetsuffix = "<br><br>"; // Tweet Suffix - some text you want displayed after each Tweet.
$feed = 'http://search.Twitter.com/search.atom?q=from:' . $username . '&rpp=' . $limit;
function parse_feed($feed, $prefix, $tweetprefix, $tweetsuffix, $suffix) {
$feed = str_replace('<', '<', $feed);
$feed = str_replace('>', '>', $feed);
$clean = explode('<content type=\"html\">', $feed);
$amount = count($clean) - 1;
echo $prefix;
for ($i = 1; $i <= $amount; $i++) {
$cleaner = explode('</content>', $clean[$i]);
echo $tweetprefix;
echo $cleaner[0];
echo $tweetsuffix;
}
echo $suffix;
}
$twitterFeed = file_get_contents($feed);
parse_feed($twitterFeed, $prefix, $tweetprefix, $tweetsuffix, $suffix);
?>