11.07.2015 Views

AJAX and PHP

AJAX and PHP

AJAX and PHP

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 9}width: 410px;background-color: #fffbb8;color: #FF9900;border: 1px solid #ffcc00;font-weight: bold;.date{font-size: 10px;color: #999999;}10. Load http://localhost/ajax/rss_reader in your web browser. The initial pageshould look like Figure 9.3. If you click one of the links, you should get somethinglike Figure 9.2.Figure 9.3: The First Page of the <strong>AJAX</strong> RSS ReaderWhat Just Happened?It's not a really professional application at this state, but the point is proven. It doesn't take muchcode to accomplish such a result <strong>and</strong> any features you might think of can be added easily.The user interface of this application is pretty basic, all set up in index.php. We first need toinclude config.php—where our feeds are defined, in order to display the list of feeds on the leftpanel. Feeds are defined as an associative array of arrays. The main array's keys are numbersstarting from 0 <strong>and</strong> its values are arrays, with keys being the feeds' titles <strong>and</strong> values being thefeeds' URLs. The $feeds array looks like this:$feeds = array ("0" => array("title" => "CNN Technology","feed" => "http://rss.cnn.com/rss/cnn_tech.rss"),233

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!