Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/04/2011, 15:08
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
Exclamación Traer informacion desde un blog en variable JSON

buenas tardes queridos colegas del foro!

Hoy me plnatee la tarea de mostrar los ultimos post de un blog (blogger/blogspot)

Y bueno, hasta ahora lo he logrado.. ahora, el problema esta en que no se como traer la imagen del post y es lo unico que me falta!

aun me cuesta entender un poco como trabaja la funciona la funcion pero ahi vamos... aca se las dejo para ver si me pueden ayudar...

La pregunta en concreto es, Que debo hacer para ahora traer la imagen del post.. cualquier info que necesiten me dicen! Gracias de antemano!!!

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

I'm back!