Note that there are some explanatory texts on larger screens.

plurals
  1. POTwitter API Atom Aggregator with C#
    primarykey
    data
    text
    <p>My issue is that I have inherited the launch of a site which has a Twitter feed ticker placed as an absolute footer on the page. The administration has decided they do not want any retweets or @mentions included in the feed. I can see the feed is being aggregated through Atom RSS. I have attempted to just change the search terms, and the twitter URL in the C# code, and the whole site crashes.</p> <p>Unfortunately, I am completely unfamiliar in C#, so my ability to modify this code is limited, at best. </p> <p>The web site is constructed with includes for the header, footer, twitter bar, etc.</p> <p>Furthermore, the projected launch for the site is this evening at COB, so drafting another plug-in from scratch is not really an option.</p> <p>The ticker is called to the page with this (The code is missing its opening and closing comment brackets so it would display here):</p> <pre><code>com.omniupdate.div label="ticker" path="/z-omniupdate/fakes/bfeo/2012/ticker.html" bf2012:ticker runat="server" /com.omniupdate.div </code></pre> <p>The CSS is:</p> <pre><code> #ticker{ width: 100%; height: 43px; border-top: 1px solid #939241; background: #bdcc2a url('/bfeo/2012/img/tweet-bg.gif') 0 0 repeat-x; background: -moz-linear-gradient(#bdcc2a, #a9b625); background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#a9b625), to(#e4c595)); background: -webkit-linear-gradient(#bdcc2a, #a9b625); background: -o-linear-gradient(#bdcc2a, #a9b625); position:fixed; z-index: 1000; bottom: 0; } #ticker p{ font-size: 15px; color: #fff; text-transform: uppercase; float: left; line-height: 43px; margin-right: 10px; } .ticker-engage { list-style: none; padding: 0; margin: 8px 0 0 0; width: 108px; height: 28px; float: left; } .ticker-engage li{ display: inline; } .ticker-engage li a{ height: 28px; width: 28px; text-indent: -9999px; float: left; margin: 0 2px 0 0; } .ticker-engage li a.twitter{ background: url('/bfeo/2012/img/twitter-sm.png') 0 0 no-repeat; } .ticker-engage li a.facebook{ background: url('/bfeo/2012/img/facebook-sm.png') 0 0 no-repeat; } .ticker-engage li a.youtube{ background: url('/bfeo/2012/img/youtube-sm.png') 0 0 no-repeat; } #tweetlist{ list-style: none; padding: 7px 20px 0 20px; height: 36px; width: 666px; float: left; background: url('/bfeo/2012/img/tweet-bg.gif') 0 0 repeat-x; background: -moz-linear-gradient(#aab726, #98a322); background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#aab726), to(#98a322)); background: -webkit-linear-gradient(#aab726, #98a322); background: -o-linear-gradient(#aab726, #98a322); font-size: 12px; } #tweetlist li{ display: inline; } #tweetlist li a:link, #tweetlist li a:visited{ color: #fff; text-decoration: none; font-weight: normal; } #tweetlist li a:hover, #tweetlist li a:focus{ text-decoration: underline; } #tweetlist li span{ color: #ffe400; } </code></pre> <p>Ticker.ascx:</p> <pre><code> &lt;%@ Control Language="C#" AutoEventWireup="true" CodeFile="ticker.ascx.cs" Inherits="bf_controls_ticker" %&gt; &lt;div id="ticker"&gt; &lt;div class="wrapper clearfix"&gt; &lt;p&gt;Engage with us&lt;/p&gt; &lt;ul class="ticker-engage"&gt; &lt;li&gt;&lt;a class="facebook" target="_blank" href="http://www.facebook.com/booththinking"&gt; Facebook&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a class="twitter" target="_blank" href="http://twitter.com/booththinking"&gt;Twitter&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a class="youtube" target="_blank" href="http://www.youtube.com/user/BoothThinking"&gt; Youtube&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;ul id="tweetlist"&gt; &lt;asp:Literal ID="Literal1" runat="server"&gt;&lt;/asp:Literal&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>ticker.ascx.cs</p> <pre><code>using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml; using System.Text; public partial class bf_controls_ticker : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { XmlDocument doc = new XmlDocument(); doc.LoadXml(HttpGet("http://search.twitter.com/search.atom?q=booththinking")); XmlNamespaceManager ns = new XmlNamespaceManager(doc.NameTable); ns.AddNamespace("at", "http://www.w3.org/2005/Atom"); ns.AddNamespace("twitter", "http://api.twitter.com/"); XmlNodeList entries = doc.DocumentElement.SelectNodes("//at:entry", ns); //Response.Write(entries.Count); StringBuilder sb = new StringBuilder(); foreach (XmlNode node in entries) { sb.Append(String.Format("&lt;li&gt;&lt;span&gt;{2}:&lt;/span&gt; &lt;a href=\"{0}\"&gt;{1}&lt;/a&gt;&lt;/li&gt;", node.ChildNodes[2].Attributes["href"].Value, node.ChildNodes[3].InnerText, node.LastChild.FirstChild.InnerText.Split(' ')[0])); } Literal1.Text = sb.ToString(); } private string HttpGet(string URI) { System.Net.WebRequest req = System.Net.WebRequest.Create(URI); System.Net.WebResponse resp = req.GetResponse(); if (resp == null) return null; System.IO.StreamReader sr = new System.IO.StreamReader(resp.GetResponseStream()); string responsexml = sr.ReadToEnd().Trim(); sr.Close(); return responsexml; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload