Weblog of Abdullah Rubiyath :: Alif

Exploring the Web: An apple a day

Blogs

jImdb: jQuery Imdb Grabber Plugin

Tue, 09/01/2009 - 00:46 -- alif

This jQuery Plugin (jimdb) allows you to Grab Movie Details from an IMDB Webpage very easily. It grabs the basic details (Title, Director, Writers, Release Date, Tag line, Plot, Runtime, MPAA, Language, Aspect Ratio, Country) from the IMDB Page and Returns the data in JSON Format.

To overcome Javascript Cross-domain restriction, a server-side proxy file has been provided in PHP with the plugin.

Displaying Star Rating using CSS Sprites

Sat, 08/29/2009 - 12:13 -- alif

Recently, I have been working on an Application which involved rating system. There are 2 cases where we would want to display ratings. On 1st case, we would just want to display the list of contents (videos, blogs etc.) with its rating (just displayed).

On another case, show the rating and also allow viewer to rate content. There are already several blogs relating to 2nd case (CSS Star Rating), so, I will only discuss the 1st case.

IMDB Details Grabber: Using PHP DOM XPath to extract Movie details

Thu, 05/21/2009 - 15:20 -- alif

Recently, a friend of mine asked me if there's an IMDB Parser that allows to fetch information about any Movie on IMDB. Unfortunately, IMDB does not offer an API, so , after doing a bit googling I found nice IMDB Grabber (PHP IMDB Grabber), despite it being a good one, I decided develop my own class relying on XPath and Dom Traversing.

PHP DomXPath: Read Complex XML files easily.

Thu, 04/16/2009 - 15:51 -- alif

XPath allows traversing through XML elements and attributes very easily. For complex XMLs, using XPath can significantly reduce the complexity of coding.

Good Tutorial of XPath can be viewed on W3C schools here. Reference on DomXPath can be viewed here.

XPath is useful if someone needs to extract a specific node from an entire XML, rather than parsing the entire XML by running a query. Below I will explain how to use DomDocument and DomXPath to read XML. At first I will start with a simple XML, and then more complex.

PHP error_reporting adds extra blank lines at top of HTML

Mon, 04/13/2009 - 18:50 -- alif

I came across an interesting scenario today. Like most developers, I like to add error_reporting(E_ALL) at the top of my PHP script. So, normally, I have my code like the following:

error_reporting(E_ALL);

immediately followed by html doctype

I noticed adding error_reporting(E_ALL) at the top of my PHP script outputs an extra blank line at the top of HTML output, which triggers Quirks mode in IE6. Finally, I found a simple way to solve it.

PHP 5 XMLReader: Reading XML with Namespace (Part 2)

Wed, 04/08/2009 - 18:00 -- alif

This is a continuation of previous article, where I wrote on how to use PHP'5 DOM to read XML Files easily. But, for large files, its better to use XMLReader. Unlike DomDocument, XMLReader does not load the entire File on memory. It reads an XML file one node at a time. I hardly use XMLReader because it requires writing a lot of codes, but for extremely large XML Files, its better to use it. Full reference on XMLReader can be viewed here. It requires PHP 5.2.

PHP 5 DOM and XMLReader: Reading XML with Namespace (Part 1)

Tue, 04/07/2009 - 18:16 -- alif

PHP-5's DOM and XMLReader provides the ability to read XML files easily. The good thing about PHP-5's DOM (mainly DomDocument, DomNodeList, DomNode) is that it implements the standard DOM features as specified by W3C. W3C's reference on DOM can be viewed here. So, if someone has used DOM before (say on JavaScript), then it would be easy for him/her to grasp PHP-5's DOM.

PHP-5 DomDocument: Creating a Basic XML

Tue, 03/31/2009 - 14:33 -- alif

Since I wrote my ZCE Exam in last Sept 08', I have been using DomDocument mainly to generate XML files. Its a powerful library of PHP-5, one thing I find surprising is the lack of tutorials on the web on PHP-5's DomDocument. So, I decided to write a simple tutorial on how to use DomDocument to write XML. In this article, I will try to explain the basics of DomDocument and then will create a couple of simple XML files.

Pages

Subscribe to RSS - blogs