Ver Mensaje Individual
  #3 (permalink)  
Antiguo 12/04/2011, 11:07
Avatar de Heiroon
Heiroon
 
Fecha de Ingreso: junio-2010
Ubicación: Caracas, Venezuela - Por ahora...
Mensajes: 495
Antigüedad: 13 años, 10 meses
Puntos: 63
De acuerdo Respuesta: Traer informacion desde un blog en variable JSON

Me respondo yo mismo:

Aca logre hacer lo que queria, muestro los ultimos posts de un blogger con imagen, fecha y descripcion.

Para el que lo necesite:

Código Javascript:
Ver original
  1. function showrecentposts(json) {
  2.    
  3.     var ObjetoJSON = json;
  4.     console.log(ObjetoJSON);
  5.    
  6.   for (var i = 0; i < numposts; i++) {
  7.     var entry = json.feed.entry[i];
  8.     var posttitle = entry.title.$t;
  9.     var posturl;
  10.     if (i == json.feed.entry.length) break;
  11.     for (var k = 0; k < entry.link.length; k++) {
  12.       if (entry.link[k].rel == 'alternate') {
  13.         posturl = entry.link[k].href;
  14.         break;
  15.       }
  16.     }
  17.     var postimage = entry.media$thumbnail.url;
  18.    
  19.     posttitle = posttitle.link(posturl);
  20.     var readmorelink = "Leer Art\xEDculo";
  21.     readmorelink = readmorelink.link(posturl);
  22.     var postdate = entry.published.$t;
  23.     var cdyear = postdate.substring(0,4);
  24.     var cdmonth = postdate.substring(5,7);
  25.     var cdday = postdate.substring(8,10);
  26.     var monthnames = new Array();
  27.     monthnames[1] = "Ene";
  28.     monthnames[2] = "Feb";
  29.     monthnames[3] = "Mar";
  30.     monthnames[4] = "Abr";
  31.     monthnames[5] = "May";
  32.     monthnames[6] = "Jun";
  33.     monthnames[7] = "Jul";
  34.     monthnames[8] = "Ago";
  35.     monthnames[9] = "Sep";
  36.     monthnames[10] = "Oct";
  37.     monthnames[11] = "Nov";
  38.     monthnames[12] = "Dic";
  39.     if ("content" in entry) {
  40.       var postcontent = entry.content.$t;}
  41.     else
  42.     if ("summary" in entry) {
  43.        
  44.       var postcontent = '<p class=\'titulo\'>' + entry.summary.$t + '</p>';}
  45.     else var postcontent = "";
  46.     var re = /<\S[^>]*>/g;
  47.     document.write('<div class=\'bloq_not\' style=\'border-bottom:1px #CCCCCC solid\'>');
  48.     postimage = postimage.replace(/s72-c/g, 's400');
  49.     document.write('<img src="' + postimage + '" width="254" height="104" alt="noticia secundaria" />');
  50.     postcontent = postcontent.replace(re, "");
  51.     if (!standardstyling) document.write('<div class="bbrecpost">');
  52.     if (standardstyling) document.write('<br/>');
  53.     document.write(posttitle);
  54.    
  55.     if (!standardstyling) document.write('</div><div class="bbrecpostsum"><p>');
  56.     if (showpostsummary == true) {
  57.       if (standardstyling) document.write('<br/>');
  58.       if (postcontent.length < numchars) {
  59.          if (standardstyling) document.write('<i>');
  60.          document.write(postcontent);
  61.          if (standardstyling) document.write('</i>');}
  62.       else {
  63.          if (standardstyling) document.write('<i>');
  64.          postcontent = postcontent.substring(0, numchars);
  65.          var quoteEnd = postcontent.lastIndexOf(" ");
  66.          postcontent = postcontent.substring(0,quoteEnd);
  67.          document.write(postcontent + '...' );
  68.          if (showpostdate == true) document.write('<div>' + readmorelink +' <br/> <span>' + cdday + ' ' + monthnames[parseInt(cdmonth,10)] + '</span></div></div>');
  69.          if (standardstyling) document.write('</i>');}
  70. }
  71.     if (!standardstyling) document.write('</p></div>');
  72.     if (standardstyling) document.write('<br/>');
  73. }
  74. if (!standardstyling) document.write('<div class="bbwidgetfooter">');
  75. if (standardstyling) document.write('<br/>');
  76. //document.write('<span style="font-size:80%;">Widget by <a href="http://beautifulbeta.blogspot.com">Beautiful Beta</a></span>');
  77. document.write('</div>');
  78.  
  79.  
  80. }
__________________
Gmail : [email protected]
Twitter: @heiroon

I'm back!