My spouse became designing a blogger template, and he or she wanted to consist of a segment for current posts. There are plenty of code sections available for download on the Internet that allow a Blogger person to add a Recent Posts phase to a blog. However, the Blogger template’s topic required the function to be protected as an indispensable part of the template in preference to being optional. I’ll show you how we executed the task.
Blogger automatically generates an XML information feed for your weblog. The feed allows people to enroll in your weblog so they’ll receive notices while you post new posts. This automatically generated information feed is placed at myblogname.Blogspot.Com/feeds/posts/default. For your precise weblog, replacement your real Blogger sub-area in the location of my blog name. If you enter your BlogSpot URL observed using/feeds/posts/default right into a browser, you’ll see the feed in your weblog on your browser window.
Accessing the feed
<br>function showrecentposts(json) ).Push();
</script></div><p>for (var i = 0; i < numposts; i++) </p><p>var entry = json.Feed.Entry[i];</p><p>var posttitle = access.Identify.$t;</p><p>var posturl;</p><p>if (i == json.Feed.Access.Duration) damage;</p><p>for (var k = 0; ok < entry.Hyperlink.Period; okay++) </p><p>if (access.Link[k].Rel == ‘exchange’) </p><p>posturl = access.Link[k].Href;</p><p>damage;</p><p></p><p></p><p>posttitle = posttitle.Link(posturl);</p><p>var readmorelink = “(extra)”;</p><p>readmorelink = readmorelink.Hyperlink(posturl);</p><p>var postdate = access.Published.$t;</p><p>var cdyear = postdate.Substring(zero,4);</p><p>var cdmonth = postdate.Substring(five,7);</p><p>var cdday = postdate.Substring(8,10);</p><p>var monthnames = new Array();</p><p>monthnames = “Jan”;</p><p>monthnames = “Feb”;</p><p>monthnames = “Mar”;</p><p>monthnames = “Apr”;</p><p>monthnames = “May”;</p><p>monthnames = “Jun”;</p><p>monthnames = “Jul”;</p><p>monthnames = “Aug”;</p><p>monthnames = “Sep”;</p><p>monthnames = “Oct”;</p><p>monthnames = “Nov”;</p><p>monthnames = “Dec”;</p><p>if (“content” in access) </p><p>var postcontent = entry.Content.$t;</p><p>else</p><p>if (“precis” in access) </p><p>var postcontent = access.Precis.$t;</p><p>else var postcontent = “”;</p><p>var re = /<S[^>]*>/g;</p><p>postcontent = postcontent.Replace(re, “”);</p><p>if (!Standardstyling) report.Write(‘<div class=”bbrecpost”>’);</p><p>if (standardstyling) record.Write(‘<br/>’);</p><p>report.Write(posttitle);</p><p>if (showpostdate == actual) record.Write(‘ – ‘ + monthnames[parseInt(cdmonth,10)] + ‘ ‘ + cdday);</p><p>if (!Standardstyling) file.Write(‘<div class=”bbrecpostsum””>’);</p><p>if (showpostsummary == authentic) </p><p>if (standardstyling) report.Write(‘<br/>’);</p><p>if (postcontent.Length < numchars) </p><p>if (standardstyling) file.Write(‘<i>’);</p><p>file.Write(postcontent);</p><p>if (standardstyling) file.Write(”);</p><p>else </p><p>if (standardstyling) file.Write(‘<i>’);</p><p>postcontent = postcontent.Substring(zero, numchars);</p><p>var quoteEnd = postcontent.LastIndexOf(” “);</p><p>postcontent = postcontent.Substring(0,quoteEnd);</p><p>report.Write(postcontent + ‘…’ + readmorelink);</p><p>if (standardstyling) document.Write(”);
<br></p><p>if (!Standardstyling) file.Write(”);</p><p>if (standardstyling) document.Write(”);
<br>if (!Standardstyling) report.Write(”);
<br>if (standardstyling) file.Write(”);
<br>if (!Standardstyling) file.Write(”);</p><p>
<script numposts=”5;var” showpostdate=”false;var” showpostsummary=”false;var” numchars=”30;var” standardstyling=”false;</script”>