- Send the url to Alchemy for title, Author, text, and image. Take the responses and build the html description that the
<item>
<title>Obama to Call for More Icebreakers in Arctic as US Seeks Foothold - New York Times</title>
<link>http://news.google.com/news/url?sa=t&fd=R&ct2=us&usg=AFQjCNEzISdc_7dbACNLX7SfwLZaa1UXBQ&clid=c3a7d30bb8a4878e06b80cf16b898331&cid=52778940195490&ei=hJjlVfCYMcvH3gGGs57IDw&url=http://www.nytimes.com/2015/09/02/us/politics/obama-to-call-for-more-icebreakers-in-arctic-as-us-seeks-foothold.html</link>
<guid isPermaLink="false">tag:news.google.com,2005:cluster=52778940195490</guid>
<category>Top Stories</category>
<pubDate>Tue, 01 Sep 2015 11:15:00 GMT</pubDate>
<description><table border="0" cellpadding="2" cellspacing="7" style="vertical-align:top;"><tr><td width="80" align="center" valign="top"><font style="font-size:85%;font-family:arial,sans-serif"><a href="http://news.google.com/news/url?sa=t&fd=R&ct2=us&usg=AFQjCNEzISdc_7dbACNLX7SfwLZaa1UXBQ&clid=c3a7d30bb8a4878e06b80cf16b898331&cid=52778940195490&ei=hJjlVfCYMcvH3gGGs57IDw&url=http://www.nytimes.com/2015/09/02/us/politics/obama-to-call-for-more-icebreakers-in-arctic-as-us-seeks-foothold.html"><img src="//t0.gstatic.com/images?q=tbn:ANd9GcTb8poiCV7-c6L52plHslVILC4Ti7eb_asJZjOiu7lRPrMAiViJFVC7YHxXBbLyaV2YQthpDI8" alt="" border="1" width="80" height="80"><br><font size="-2">New York Times</font></a></font></div></font></td></tr></table></description>
</item>
- Obviously, the description part is the trickiest, but it doesn’t have to be as rich in content
- Tutorial on RSS
- Encoding and decoding html using PHP
- In looking at the above, I think the first thing to do is to build the template for displaying the output, then encode it and see if it can be displayed. Here’s an example of a GoogleNews item:
<table border="0" cellpadding="2" cellspacing="7" style="vertical-align:top;">
<tr>
<td width="80" align="center" valign="top">
<font style="font-size:85%;font-family:arial,sans-serif">
<a href="http://news.google.com/news/url?sa=t&fd=R&ct2=us&usg=AFQjCNEzISdc_7dbACNLX7SfwLZaa1UXBQ&clid=c3a7d30bb8a4878e06b80cf16b898331&cid=52778940195490&ei=hJjlVfCYMcvH3gGGs57IDw&url=http://www.nytimes.com/2015/09/02/us/politics/obama-to-call-for-more-icebreakers-in-arctic-as-us-seeks-foothold.html">
<img src="//t0.gstatic.com/images?q=tbn:ANd9GcTb8poiCV7-c6L52plHslVILC4Ti7eb_asJZjOiu7lRPrMAiViJFVC7YHxXBbLyaV2YQthpDI8" alt="" border="1" width="80" height="80">
<br>
<font size="-2">New York Times</font>
</a>
</font>
</td></tr></table>
- Ran into problems with Imagick that seem to be legendary. Rather than dealing with it on the dev box, and since it seems to be there on the main server, I’m using this hacky workaround and just ignoring it for now. What I want is thumbnails so that the asset folder doesn’t get crushed. But that’s not critical right now.
- Finished building the itemHtml
private function constructHtml(){
$htmlStr = '<table border="0" cellpadding="2" cellspacing="7" style="vertical-align:top;" width="100%"><tr><td width="80" align="center" valign="top">';
$htmlStr .= '<a href="'.$this->rssLink.'">';
$htmlStr .= '<img src="assets/'.$this->rssImage.'"height="80"></a></td>';
$htmlStr .= '<td width="80%" align="left" valign="top"><span style="font-size:85%;font-family:arial,sans-serif">';
$htmlStr .= '<a href="'.$this->rssLink.'">'.$this->rssTitle.'</a>';
$htmlStr .= '<p>'.$this->rssDescription.'</p>';
$htmlStr .= '</span></td></tr></table>';
$this->rssDescription = $htmlStr;
}
- Tomorrow we’ll wire it up so that http and https ‘queries’ get handled from the client
You must be logged in to post a comment.