Monthly Archives: December 2013

Client-Side vs. Server-Side Rendering

 

Yesterday Twitter announced that it was moving away from client-side rendering back to server-side rendering in order to improve page load time. Today I found myself having to defend my position that server-side rendering will almost always be faster. I figured I’d blog about it.

I want to point out a couple things. First, I’m talking specifically about render performance and page speed. There might be other compelling advantages to thick-clients; I’m talking about performance. Secondly, I’m going to get on a high horse here and say that it worries me that developers think client-side rendering is faster. This is basic and fundamental knowledge about how the web and browsers work. Maybe I’ll be proven wrong. If I am, I’ll admit it. It’ll be embarrassing because it means that I don’t know the fundamentals. But I’ll be glad to have learned (which is why I blog).
Read more at: http://openmymind.net/2012/5/30/Client-Side-vs-Server-Side-Rendering/

php rss feed to json

This is a simple script that grabs a rss file and converts it to json.
It was copied from http://onwebdev.blogspot.com/2011/08/php-converting-rss-to-json.html but it has some little changes that will work 100%!

In fact the original code was putting every title, description, pubDate and guid in a new array entry.

$feed = new DOMDocument();
 $feed->load('file.rss');
 $json = array();
 $json['title'] = $feed->getElementsByTagName('channel')->item(0)->getElementsByTagName('title')->item(0)->firstChild->nodeValue;
 $json['description'] = $feed->getElementsByTagName('channel')->item(0)->getElementsByTagName('description')->item(0)->firstChild->nodeValue;
 $json['link'] = $feed->getElementsByTagName('channel')->item(0)->getElementsByTagName('link')->item(0)->firstChild->nodeValue;
 $items = $feed->getElementsByTagName('channel')->item(0)->getElementsByTagName('item');

 $json['item'] = array();
 $i = 0;

 foreach($items as $key => $item) {
 $title = $item->getElementsByTagName('title')->item(0)->firstChild->nodeValue;
 $description = $item->getElementsByTagName('description')->item(0)->firstChild->nodeValue;
 $pubDate = $item->getElementsByTagName('pubDate')->item(0)->firstChild->nodeValue;
 $guid = $item->getElementsByTagName('guid')->item(0)->firstChild->nodeValue;

 $json['item'][$key]['title'] = $title;
 $json['item'][$key]['description'] = $description;
 $json['item'][$key]['pubdate'] = $pubDate;
 $json['item'][$key]['guid'] = $guid; 
 }

echo json_encode($json);