Posted by Shaiful Borhan on August 29, 2010
Shaiful talks about how simple it is to use the nifty little SimplePie library to fetch web feeds. Shaiful Borhan is the Web Analyst and Developer at Stampede.
Let’s say we have a university website running on a CMS and a couple of student blogs running on a blogging tool like WPMU. Then on the university website homepage we need to pull several latest blog teasers from the student blogs. We can accomplish this quite easily with a free PHP class called SimplePie. What the library does is it fetches the blog RSS or Atom feed that we provide and parses it into an easy to use formatted data.
require_once('simplepie.inc');
$webfeed = "http://mywordpressblog.com/index.php?feed=rss2";
$feed = new SimplePie();
$feed->set_feed_url($webfeed);
// $feed->set_cache_location("./cache_folder"); //set your own cache folder; default ./cache
// $feed->set_cache_duration(1800); //cache duration in number of minutes; default 3600
$feed->init();
$feed->handle_content_type();
echo '<ul>';
foreach ($feed->get_items(0, 3) as $key => $item) {
echo '<li>';
echo '<a href="'. $item->get_permalink() .'">'. $item->get_title() .'</a>';
echo '</li>';
// $item->get_description() to get the teaser
// $item->get_date('F jS, Y') to get the date formatted using php date()
}
echo '</ul>';
A thing to note here is the foreach loop in line 13 controls how many items you would like to retrieve from the feed. In the example above, it’s set to read three feed items (stated as 3) starting from the first item (stated as 0).
One of the advantages of using SimplePie is performance. SimplePie is configured to grab and cache the feed so that the server doesn’t have to fetch them every time the webpage is loaded. By default, SimplePie stores its cache in a directory called “cache” with a cache duration of an hour. So it’s advisable to create this directory with a correct permission assigned in advance. These default settings can be overridden very easily.
Besides standalone code, you can also find a handful of SimplePie plugins that were built for major CMS such as Joomla! or Drupal. With web feeds becoming quite common today, you can use SimplePie in many creative ways for instance to fetch Tweets, Flickr photos or cool products from eBay.
Posted in Code Add Comment »
Posted by Shaza Hakim on August 27, 2010

“Stop worrying about the fold. Don’t throw your best practices out the window, but stop cramming stuff above a certain pixel point. You’re not helping anyone. Open up your designs and give your users some visual breathing room. If your content is compelling enough your users will read it to the end.”
- Boxes and Arrows on Blasting the Myth of the Fold
I have been planning and designing websites for quite a while now and in recent years, the same notes keep creeping into our clients’ revision request: “Reduce the header height, move sections upward, try to keep everything above the fold.”
This could be a residue of the news-print industry where newspapers come folded up and the area “above the fold” must be exciting enough to compel people to purchase the paper.
We can apply the same argument to a website, whereby the fold line represents the area where vertical scrolling is required to view more content of a webpage. Instead of cramming as many “important information” into the area, try to prioritize and understand your audience. A first time visitor to your website needs a reason to stay intrigued past 5 seconds. Think of the area above fold as a compelling opportunity to entice, not overwhelm. In most cases, a simple but good, well-thought imagery and a line or two even better copy will hook enough for them to want more.
More importantly, by keeping restraint on what goes above fold, you are letting your most important content breathe.
Also remember that most people browsing the web today understands the purpose of scrolling. Every visitor to your website needs to learn quickly what your website is about, or else you’ll lose them. You will not do any better by crowding the header area – that would only dilute your message. What you want is just the right combination of visual impact and concise information. If they have quickly discovered what your website is about and now interested in the rest of your content, they will scroll to read more.
(photo by Alan)
Posted in Design Add Comment »