WordPress.org

Support

Support » Miscellaneous » Creating a Google Gadget for a WP feed

Creating a Google Gadget for a WP feed

  • This is not an actual problem with WP or even related to WP code as such. However there are a lot of clever people out there who might be able to help.

    I’ve been having a go at creating a Google Gadget which reads my feed content and displays it in a module (gadget) within the Google Personalized homepage.

    I’ve followed Google’s own suggested code, which works OK for me when the Google blog feed is used, but when I switch it over to my own feed it goes blank.

    Google is definitely reading the feed because when I change the gadget code to just point at the feed url it does display it within the box, without any formatting of course.

    Google’s suggested code, from:

    http://www.google.com/apis/homepage/guide.html

    is as follows:
    ******************************************
    <?xml version=”1.0″ encoding=”UTF-8″ ?>
    <Module>

    <ModulePrefs title=”Google Blog” render_inline=”optional” />
    <UserPref name=”post” datatype=”enum” display_name=”Post Number” default_value=”1″>

    <EnumValue value=”1″ />
    <EnumValue value=”2″ />
    <EnumValue value=”3″ />
    <EnumValue value=”4″ />
    <EnumValue value=”5″ />
    <EnumValue value=”6″ />
    <EnumValue value=”7″ />
    <EnumValue value=”8″ />
    <EnumValue value=”9″ />
    </UserPref>

    <Content type=”html”>
    <![CDATA[
    <!– load the NXSL library –>
    <script src=”http://www.google.com/js/nxsl.1.js” type=”text/javascript”></script>
    <div id=”content___MODULE_ID__”></div>

    <script type=”text/javascript”>
    _IG_RegisterOnloadHandler(function () {
    var url = ‘http://googleblog.blogspot.com/atom.xml’;
    _IG_FetchContent(url, function (response) {
    var prefs = new _IG_Prefs(__MODULE_ID__);
    var nxsl = xmlParse(”
    + ‘<div select=”/feed/entry[‘ + prefs.getInt(‘post’) + ‘]”>’
    + ‘ <h3 select=”title” content=”.”></h3>’
    + ‘ <div select=”content” content=”.”></div>’
    + ‘</div>’);
    nxslProcess(xmlParse(response), nxsl);
    var content = xmlText(nxsl);
    content = content.replace(/</g, ‘<‘)
    .replace(/>/g, ‘>’)
    .replace(/&/g, ‘&’)
    .replace(/[“]byline-author[“]/g,
    ‘”byline-author” style=”font-size:84%;color:#666666;”‘);
    _gel(‘content___MODULE_ID__’).innerHTML = content;
    });
    });
    </script>

    ]]>
    </Content>
    </Module>
    **********************************************

    Maybe someone has tried this before? Any suggestions appreciated!

Viewing 1 replies (of 1 total)
  • This is not an actual problem with WP or even related to WP code as such.

    Then why are you posting here?

Viewing 1 replies (of 1 total)
  • The topic ‘Creating a Google Gadget for a WP feed’ is closed to new replies.
Skip to toolbar