Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Alex Burr 77 posts 128 karma points
    Jul 22, 2010 @ 15:44
    Alex Burr
    0

    Tweets not displaying...

    I've just installed this package and cannot get any results back. I am guessing that I don't have something configured properly somewhere, but what it might be I have no idea.

    I've done a little debugging of the XSLT to try to pinpoint the problem. When I add in the following output to the default xslt:

    <xsl:choose>
          <xsl:when test="$displayReplies = 1">
            <xsl:value-of select="$twitterXMLUrl"/>: Showing replies       
            <!-- Just show user's tweets only and display @replies -->
            <xsl:for-each select="umbraco.library:GetXmlDocumentByUrl($twitterXMLUrl)//statuses/status">
              <!-- Check that we only show the number of tweets we want -->
              <xsl:if test="position() &lt;= $noStatus">
                <xsl:apply-templates mode="tweet" select="current()"/>
              </xsl:if>
            </xsl:for-each>
          </xsl:when>
          <xsl:when test="$displayReplies = 0">
            <xsl:value-of select="$twitterXMLUrl"/>: NOT showing replies
            <!-- Just show user's tweets only and DONT display @replies -->
            <xsl:for-each select="umbraco.library:GetXmlDocumentByUrl($twitterXMLUrl)//statuses/status [in_reply_to_screen_name = '']">
              <!-- Check that we only show the number of tweets we want -->          
              <xsl:if test="position() &lt;= $noStatus">
                <xsl:apply-templates mode="tweet" select="current()"/>
              </xsl:if>
            </xsl:for-each>
          </xsl:when>
        </xsl:choose>

    I get the proper message regarding Twitter username and reply flag. So I know that xsl:when test condition is being met. So then I try another little output test:

    <xsl:choose>
          <xsl:when test="$displayReplies = 1">
            <!-- Just show user's tweets only and display @replies -->
            <xsl:for-each select="umbraco.library:GetXmlDocumentByUrl($twitterXMLUrl)//statuses/status">
              Test
              <!-- Check that we only show the number of tweets we want -->
              <xsl:if test="position() &lt;= $noStatus">
                <xsl:apply-templates mode="tweet" select="current()"/>
              </xsl:if>
            </xsl:for-each>
          </xsl:when>
          <xsl:when test="$displayReplies = 0">
            <!-- Just show user's tweets only and DONT display @replies -->
            <xsl:for-each select="umbraco.library:GetXmlDocumentByUrl($twitterXMLUrl)//statuses/status [in_reply_to_screen_name = '']">
              <!-- Check that we only show the number of tweets we want -->
              Test
              <xsl:if test="position() &lt;= $noStatus">
                <xsl:apply-templates mode="tweet" select="current()"/>
              </xsl:if>
            </xsl:for-each>
          </xsl:when>
        </xsl:choose>


    And nothing is displayed. I would expect to see the word "Test" output the number of times specified in my noStatus parameter.

    Therefore I expect the xsl:for-each is counting to zero and breaking. Anything in the umbraco.library or $twitterXMLUrl variable that could be causing this?

  • Alex Burr 77 posts 128 karma points
    Jul 22, 2010 @ 17:02
    Alex Burr
    0

    Ok to make it more complicated...

    It seems like it *is* working, but only sporadically. Sometimes visiting the page will yield blank results, other times I get the expected list of tweets.

    Anyone have thoughts on what it could be?

  • Warren Buckley 2106 posts 4836 karma points MVP ∞ admin hq c-trib
    Jul 22, 2010 @ 17:33
    Warren Buckley
    0

    Hello Alex,
    What settings do you have set for the macro please?

    Warren

  • Alex Burr 77 posts 128 karma points
    Jul 23, 2010 @ 16:16
    Alex Burr
    0

    I am using the macro on two different websites:

    1. Intranet (Buggy)

    This is an intranet site, being built on Umbraco 4.5.0. I set the macro to "Use in editor", but other than that I have made no modifcations. I have added it to a page with the following settings:

    This is the instance that works only intermittently. However, I only made the "Use in editor" switch recently. Before that I put the macro directly in my template like so:

    <umbraco:Macro twitterUsername="URMCdiscoveries" noStatus="5" displayReplies="0" displayMaps="0" zoom="" size="" mapType="" Alias="CWS_twitter" runat="server"></umbraco:Macro>

    And had the exact same problem. This problem persisted even when I set twitterUsername="warrenbuckley".

    2. Public (Works fine)

    This project (unrelated to the first) is being built on Umbraco 4.0.3. I have made extensive modifications to the XSLT on this one, but have not set "Use in editor". I only use this version directly in my template:

    <umbraco:Macro twitterUsername="gjswing" noStatus="3" displayReplies="0" displayMaps="0" zoom="" size="" mapType="" Alias="CWS_twitter" runat="server"></umbraco:Macro>

    This one has never given me any problems.

  • Warren Buckley 2106 posts 4836 karma points MVP ∞ admin hq c-trib
    Jul 23, 2010 @ 18:49
    Warren Buckley
    0

    Hello Alex,
    It is strange one version is working perfectly fine and the other is not.

    I am wondering if you are using slightly different version of Twitter for Umbraco.

    If you goto this line and check it now reads like this, main difference from this latest version below and older versions is
    that I am requesting the max number of tweets at 200 and filtering them further down. Where

    <!-- Twitter XML URL -->
    <xsl:variable name="twitterXMLUrl" select="concat('http://twitter.com/statuses/user_timeline/', $twitterUsername ,'.xml?count=200')"/>

     

    Have you tried any form of caching to see this helps the problem?

    Also recently the Twitter API has been having problems and I wonder if this is part of the problem, if so I think we would need to look at caching the XML from twitter so that we can always use it.

    Warren :)

     

  • Alex Burr 77 posts 128 karma points
    Jul 26, 2010 @ 21:21
    Alex Burr
    0

    Hi Warren, the line you provided is in both of my implementations. I downloaded the package just last week and installed it simultaneously on both sites.

    I can verify (through some debugging) that when the page is showing up blank, it's because

    <xsl:value-of select="umbraco.library:GetXmlDocumentByUrl($twitterXMLUrl)//statuses/status" />

    is empty.

    Can you point me to any resources on how to do some caching?

  • Warren Buckley 2106 posts 4836 karma points MVP ∞ admin hq c-trib
    Jul 26, 2010 @ 21:54
    Warren Buckley
    0

    When this site is intermittly having issues. Please check this URL is returning any results.
    http://twitter.com/statuses/user_timeline/Username.XML?count=200

    When you are viewing the page in your browser, are you forcing a refresh?
    eg CTRL + F5

    When viewing in FireFox with FireBug. Does any markup get generated?

    Have you tried changing the macro setting to match that of the working site?
    Does this then work?

    Another idea you could try is to do the following. So we can see the XML feed we are getting from twitter.
    Let me know what this returns please.

    <textarea>
      <xsl:copy-of select="umbraco.library:GetXmlDocumentByUrl($twitterXMLUrl)" />
    </textarea>
  • Alex Burr 77 posts 128 karma points
    Jul 29, 2010 @ 17:46
    Alex Burr
    0

    When the issue occurs, the code above returns nothing. Then when I visit http://twitter.com/statuses/user_timeline/Username.XML?count=200 (using the proper username) I see nothing. Therefore I am guessing this has to do with the Twitter API.

    I've added this message before the <xsl:choose> element to at least handle this error somewhat:

    <xsl:if test="not(umbraco.library:GetXmlDocumentByUrl($twitterXMLUrl)//statuses/status)">
    <p><em>No values retrieved from Twitter API.</em></p>
    </xsl:if>

    Thanks for your help! At least I know I'm not crazy.

     

  • Warren Buckley 2106 posts 4836 karma points MVP ∞ admin hq c-trib
    Jul 29, 2010 @ 17:57
    Warren Buckley
    0

    Hiya Alex,
    I am quite relieved to hear it was a problem with the API rather than my code, as it really had my head scratching on what the problem could be.

    Warren :)

  • BarneyHall 141 posts 210 karma points
    Sep 19, 2010 @ 20:27
    BarneyHall
    0

    I keep getting this too. Seems Twitter is pretty unstable at the moment.

    Could some one explain how to add this failsafe to display a message if Twitter is unavailble?

    Many thanks,
    Barney

  • Alex Burr 77 posts 128 karma points
    Sep 20, 2010 @ 15:11
    Alex Burr
    0

    Hi Barney,

    I modified the XSL to include a "graceful failure" when the API is unresponsive. This is not as ideal as it would be to 1) cache the feed and 2) use the most recently cached version for display when the feed is unresponsive. Someone with a deeper knowledge than I would have to provide help with that.

    Anyway here's what I'm doing:

      <xsl:template match="/">

    <!-- Twitter XML URL -->
    <xsl:variable name="twitterXMLUrl" select="concat('http://twitter.com/statuses/user_timeline/', $twitterUsername ,'.xml?count=200')"/>

    <!-- Failure message added A.Burr 7/29/10 -->
    <xsl:if test="not(umbraco.library:GetXmlDocumentByUrl($twitterXMLUrl)//statuses/status)">
    <p><em>No values retrieved from Twitter API.</em></p>
    </xsl:if>

  • Warren Buckley 2106 posts 4836 karma points MVP ∞ admin hq c-trib
    Sep 20, 2010 @ 17:32
    Warren Buckley
    0

    Hello Barney,
    Yes unfortunately the Twitter API is a bit unreliable at times. What Alex has suggested is a good suggestion for an easy fix.

    But as Alex suggested you need proper caching, so I can recommend you use Darren Ferguson's FeedCache package which will go off and download the same XML to a local file in your umbraco site, but it will require tweaking and updating the twitter XSLT file to support it.

    If you both require this as a feature, create an item/feature request on the Twitter 4 Umbraco codplex project site
    http://twitter4umbraco.codeplex.com

    http://twitter4umbraco.codeplex.com/workitem/list/basic

     

    Warren :)

  • Andrew Dempster 1 post 21 karma points
    Nov 16, 2011 @ 17:40
    Andrew Dempster
    0

    Sorry to resurect this thread but I've found it very helpful so far. I'm very new to Umbraco (and .Net for that matter) and I've been having exactly the same issues as these with the latest release on the WebMatrix platform (umbraco v 4.7.1 (Assembly version: 1.0.4281.20201) & 1.6 of the Twitter package).

    I've got the error message popping up nicely (thanks Alex!) and I've added your error capture which returns the following:

    <error url=" http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=BrizzleRocker&include_rts=true&count=200">System.Net.WebException: The remote server returned an error: (407) Proxy Authentication Required.
       at System.Net.HttpWebRequest.GetResponse()
       at umbraco.library.GetXmlDocumentByUrl(String Url)</error>

    Interestingly I've tried this off the corporate network with the same results so I'm not sure if it's misleading. Unfortunately I have zero experience to date so any help you can offer with this brilliant addition would be welcome!

    Any idea's please?

    Andrew

Please Sign in or register to post replies

Write your reply to:

Draft