SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Jun 2004
    Location
    PA
    Posts
    235
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to display an excerpt on a Google Gadget

    Hi,

    I had created a google gadget that only displayed the titles of my RSS feed items. I now want an excerpt to display as well. Does anyone know what I should add to get the blurb to display? Here is an excerpt from my code.

    <Content type="html">
    <![CDATA[
    <style> #OUT__MODULE_ID__ { font-size: 80%; margin: 5px;} </style>

    <div id=OUT__MODULE_ID__></div>
    <script type="text/javascript">
    // Tells gadget to resize itself
    _IG_AdjustIFrameHeight();

    // Get userprefs
    var prefs = new _IG_Prefs(__MODULE_ID__);
    var showdate = prefs.getBool("show_date");
    var summary = prefs.getBool("show_summ");
    var entries = prefs.getInt("num_entries");

    document.bgColor = prefs.getString("bgcolor");

    // Use the _IG_FetchFeedAsJSON() function to retrieve core feed data from
    // the specified URL. Then combine the data with HTML markup for display in
    // the gadget.
    _IG_FetchFeedAsJSON("MY FEED URL",
    function(feed) {
    if (feed == null){
    alert("There is no data.");
    return;
    }

    // Start building HTML string that will be displayed in gadget.
    var html = "";

    // Access the fields in the feed
    //html += "<div><b>" + feed.Title + "</b></div>";
    //html += "<div>" + feed.Description + "</div><br>";

    // Access the data for a given entry
    if (feed.Entry) {
    for (var i = 0; i < feed.Entry.length; i++) {
    html += "<div>"
    + "<a href='" + feed.Entry[i].Link + "' target='" + feed.Entry[i].Title + "'>"
    + feed.Entry[i].Title
    + "</a> ";

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,269
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)
    Maybe
    Code:
    feed.Entry[i].Description


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •