Ver Mensaje Individual
  #3 (permalink)  
Antiguo 11/01/2011, 09:40
_WILCO_
 
Fecha de Ingreso: marzo-2005
Mensajes: 26
Antigüedad: 19 años, 1 mes
Puntos: 0
De acuerdo Muestra TWEETS en tu web de forma atractiva

¡Magia! http://forpe.es/ya.php

Gracias quinqui, se ha resuelto simplemente seteando el idioma:

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

<meta http-equiv="content-language" content="es" />

Dejo el código completo para quien lo quiera usar. Es una aplicación que muestra el número de tweets deseado de una bonita forma.

Código PHP:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2.  
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es" dir="ltr">
  4.  
  5. <head>
  6.  
  7. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  8.  
  9. <meta http-equiv="content-language" content="es" />
  10.  
  11. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
  12.  
  13. <script type="text/javascript">
  14. jQuery(function($) {
  15.     var tweets = {
  16.         el: '.twitterTicker .twitter-stream',
  17.         items: new Array(),
  18.         count: 0,
  19.         total: -1,
  20.         delay: 6000,
  21.         animate: true
  22.     };
  23.     $(tweets.el+' p').each(function(i) {
  24.         tweets.items[i] = $(this).html();
  25.         tweets.total++;
  26.     }).hide();
  27.     runTweeter();
  28.     function runTweeter() {
  29.         if(tweets.animate == true) {
  30.             if($(tweets.el+' p').length > 0) {
  31.                 $(tweets.el).children('p').fadeOut(500, function() {
  32.                     $(this).parent(0).empty().append('<p style="display: none;">'+tweets.items[tweets.count]+'</p>').children('p').fadeIn(500);
  33.                 });
  34.             } else {
  35.                 $(tweets.el).empty().append('<p style="display: none;">'+tweets.items[tweets.count]+'</p>').children('p').fadeIn(750);
  36.             }
  37.         } else {
  38.             $(tweets.el).empty().append('<p>'+tweets.items[tweets.count]+'</p>');
  39.         }
  40.         setTimeout(function() {
  41.             if(tweets.count == tweets.total) {
  42.                 tweets.count = 0;
  43.             } else {
  44.                 tweets.count++;
  45.             }
  46.             runTweeter();
  47.         }, tweets.delay);
  48.     }
  49. });
  50. </script>
  51.  
  52.         <style type = "text/css">
  53.  
  54.             .twitter-stream {
  55.             background: #d5e8ef;
  56.             border: 1px solid #d5e8ef;
  57.             -moz-border-radius: 7px;
  58.             -webkit-border-radius: 7px;
  59.             -khtml-border-radius: 7px;
  60.             border-radius: 7px;
  61.             padding: 10px;
  62.             margin: 0 0 20px 0;
  63.             font-size: 10px;
  64.             color: #6e6f73;
  65.             font-weight: bold;
  66.             font-family: verdana;
  67.             float: left;
  68.             width: 87%;
  69.         }
  70.         .twitter-stream p {
  71.             padding: 0px;
  72.             margin: 0px;
  73.         }
  74.         .twitter-stream p a {
  75.             color: #45799f;
  76.             text-decoration: none;
  77.         }
  78.  
  79.         </style>
  80.  
  81.     </head>
  82.  
  83.     <body>
  84.  
  85.         <div class="twitterTicker"><img src="http://return-true.com/wp-content/themes/returntrue/images/layout/twittertickerbird.jpg" style="float:left;" />
  86.  
  87.                 <?php
  88.                         $doc = new DOMDocument();
  89.  
  90.                         # load the RSS -- replace 'username' with your own twitter username
  91.                        if($doc->load('http://twitter.com/statuses/user_timeline/Fundacion_Forpe.rss')) {
  92.                           echo "<div class='twitter-stream'>";
  93.  
  94.                           # number of <li> elements to display.  20 is the maximum
  95.                          $max_tweets = 10;  
  96.  
  97.                           $i = 1;
  98.                           foreach ($doc->getElementsByTagName('item') as $node) {
  99.                             # fetch the title from the RSS feed.
  100.                            # Note: 'pubDate' and 'link' are also useful (I use them in the sidebar of this blog)
  101.                            $tweet = $node->getElementsByTagName('title')->item(0)->nodeValue;
  102.  
  103.                             # the title of each tweet starts with "username: " which I want to remove
  104.                            $tweet = substr($tweet, stripos($tweet, ':') + 1);  
  105.  
  106.                             # OPTIONAL: turn URLs into links
  107.                            $tweet = preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@',
  108.                                   '<a href="$1">$1</a>', $tweet);
  109.  
  110.                             # OPTIONAL: turn @replies into links
  111.                            $tweet = preg_replace("/@([0-9a-zA-Z]+)/",
  112.                                   "<a href=\"http://twitter.com/$1\">@$1</a>",
  113.                                   $tweet);
  114.  
  115.                             echo "<p>". $tweet  . "</p>";
  116.  
  117.                             if($i++ >= $max_tweets) break;
  118.                           }
  119.                           echo "</div>";
  120.                         }
  121.  
  122.                         ?>
  123.     </body>
  124.  
  125. </html>

Encontrado en http://return-true.com/2010/09/building-a-twitter-ticker-with-jquery

Saludos.