Parsing XML using PHP: SimpleXML

Introduction

“Simplicity of character is no hindrance to the subtlety of intellect.”

- John Morley

When people ask me “What is SimpleXML?” I often quip, “XML is the solution to all your problems; SimpleXML ensures it isn’t the root of your problems!”

Those of you who have parsed XML with PHP4, or are currently dealing with XML parsing in PHP4, know that it can indeed be very painful to handle documents with any degree of complexity. You either need to use the SAX approach and write a handwritten parser for every document, or you need to use the DOM extension; which (in addition to its tendency to crash, leak and generally misbehave under heavy usage) involves the pain of processing documents using an API designed for a heavily object oriented language and

Read the rest of this entry »

Pagination: Easy as PREV 1 2 3 NEXT (REVISED)

Pagination: Easy as PREV 1 2 3 NEXT (REVISED)

Alright. You’ve had enough, haven’t you? Pouring countless hours into trying to figure out pagination. Yep, I feel your pain. Don’t fret though, this tutorial will get you through it without too many bruises–it’s easier than you think.

For those of you who don’t know, pagination (in the Web world) is usually dividing a large list of items into several pages, and then providing a nifty link for it. You usually see pagination link displayed like this:

PREV 1 2 3 4 5 NEXT

Read the rest of this entry »

Displaying RSS Feeds

 

Displaying RSS Feeds

by: S. Housley RSS offers webmasters a unique opportunity to display fresh content on websites. While publishing an RSS feed is a great way to generate site interest and increase communication, syndicating and displaying feeds from related relevant sources can also generate interest, increase traffic and improve search engine ranking.

RSS Radars
Webmasters with limited time or capacity can syndicate related content. In a nut shell, webmasters can create RSS

Read the rest of this entry »

Simple PHP/MySQL Pagination Class

In this article you will learn a simple method to make PHP/MySQL Pagination Class.

What is Pagination?
==============

What if you have a table with a thousand rows, and you want to allow
the user to browse through the entire table. Simply listing all the
records in that table would not be a good idea. Instead you should
break the table up into smaller “chunks” and allow the user to
navigate through theses “chucks”. This is what pagination does, it
allows you to break up large result sets from a database query, and
present it to the user in a more manageable way.

Read the rest of this entry »

DevShed Tutorial: Creating an RSS Reader

Devshed articles have been a great resource for php-learners to learn php techniques very quickly and easily. A similar article on making a RSS (Rich Site Summary) has been posted on Devshed.

In this article we are going to discuss how to create a PHP-based RSS reader. It would be helpful if you know something about XML, but not really necessary. RSS documents have three main tags: Title, You can read the rest of this awesome article at http://www.devshed.com/c/a/MySQL/Creating-an-RSS-Reader-the-Reader/ 

 

Guilherme Blanco’s Blog: register_superglobal(”NAME”);

Some time ago I spoke with Derick Rethans about the possibility to create a function called “register_superglobal”.
Currently, we deal with a lot of interesting situations of web applications, and some really interesting are the superglobals variables. Seems there will be a change in superglobals soon and that’s why I decided to post about it here.

When you build an application in PHP, and you want to access the Database class instance in a method, you have 2 possibilities:

  • Pass the global variable, like globals $db or accessing via $GLOBALS[’db’]
  • Using a singleton pattern, and accessing $db = & Database::getInstance(); (PHP5 does not require the ref signal anymore)

While the last one seems to be the best solution, you have a problem of generating classes to each Database connection. So, if you are dealing with 3 Database connections, you will have to modify the singleton accessor to support multiple named instances.

Read the rest of this entry »

Yahoo Hiring PHP Developers!

The creators of PHP - Rasmus Lerdorf has posted the following on his blog,

“Want to work on some of the busiest and coolest web apps in the world?

Do you like Flickr, and want to work downtown San Francisco?

Or perhaps you are into music, movies or TV and want to work out of Santa Monica? Jumpcut? Or have you seen answers.yahoo.
com? Address Book, Personals, Search, Premium Services, Hot Jobs? Want to do interesting things combining PHP and Flash?

Yes, I get a referral bonus, but I need more toys. You get a cool job though, so I think we are even.

Send me your resume
Read the rest of this entry »

Detailed Guide On Arrays In PHP

Good Day!

Here is yet another article of Fast PHP Articles Series. Today we are going to discuss ARRAYS. We will learn its syntax, its different types, the different built-in Array functions that help to perform different tasks related to Arrays quickly and different practical examples explaining the use of Arrays in PHP.

By the end of this article you should be able to ,

- Define Arrays :)
- Use different types of Arrays
- Use different Built-in functions related to Arrays e.g list(), each(), var_dump, print_r, var_export()

- Write basic as well as complex php code using Arrays.
- Working with multidimensional arrays
- Understanding Foreach loop with the help of different examples

Read the rest of this entry »

DevShed: Handling File Data with the Facade Pattern in PHP 5

Full Article: http://www.phpdeveloper.org/news/7152

DevShed has posted the last installment of their series looking at the use of the Facade design pattern. This time, they’re looking specifically at its use in handling file data for the items on the local file system.

I’m going to continue demonstrating the application of the facade pattern, this time by developing yet another illustrative application. It will take care of processing the contents of a selected data file in different ways.

They start from scratch with the development of the sample script - creating a simple class that implements the pattern, then modifying it to work as a string processor and finally pulling them together to read the data for a file and echo out the processed results.

.htaccess Based Authentication On Subdirectories

+=======================================+

Author: Nayyar Ahmad.

Contact:  nayyares *AT* gmail *DOT* com

Dedication: To Baji (my mom). for all those efforts, she did for me.

+=======================================+

Preface:

.htaccess is used to provide facility of changing configuration per directory basis, this file can contains one or more directives that is going to be forced on the directory contains .htaccess.

.htaccess is papular name of this configuration modification file, you can change this default name by changing AccessFileName parameter in apache config file. i.e.

AccessFileName .anyname

In this howto, I will take a dumy scenario of two parallel level subdirectories and will implement password authentication on both of them.
Read the rest of this entry »

« Previous entries ·