PHP Object Oriented tutorials
Are you a PHP developer wishing to find an approachable guide that walks you through building different kinds of helper classes in PHP 5? Then look no further, because this group of articles may be the material that you really need.
Related Tutorials
Developing a URL Handling Helper Class in PHP 5
In this third installment of a series on building helpers in PHP 5, I will provide you with the basic pointers for building a URL-handling helper class. The code examples, though simple, should serve to demonstrate how to create a helper that generates dynamic URLs.
How to handle URLs
URL handling is one of the tasks you have to do from time to time in PHP. Sometimes you have to do it because you want to record the referral sites, other times because you want to write your own spider or just because you want to retrieve your current URL. PHP is a language developed around web for web developers and it contains all the functions you might need in your quests.
Calling Methods Out of Object Scope
Theoretically defining the role of helper classes in PHP 5 (and other popular server-side scripting languages) is a pretty approachable process. As their name suggests, helper classes provide developers with a set of logically-grouped methods that allow them to easily perform certain repetitive tasks that are common to different web applications.
Error Handling
Every programmer wants to practice effective error handling. Learn how to control the size and other aspects of file uploading on your server by error handling.
An Expandable Form Validation Class: Part 2
In Part 1 of this tutorial, we covered the basics of our Form Validation Class. We explained how the core of the Class depends on regular expressions and gave an insight regarding the keyword concept. We also explained how each keyword will have a corresponding Class Method so that we can easily extend the Class in the future to suit our needs. In Part 2, we will get our hands dirty in creating the remaining useful Class Methods that will instruct the Class which form fields to validate and how to validate them.
Error Handling
Every website will encounter errors from time to time. Most sites will not have any error handling in place and the visitor will most likely receive a cryptic programming error. This can turn visitors away as they don't know what is happening. The way around this is to provide some error handling in your scripts. By testing for errors at crucial stages (e.g accessing a database) you can provide a friendly error message for the user. This tutorial will show you how the error handling functions for the LATEdownload v2 script have been written and how you can use them in your own site.
Verifying a URL
Learn how to see if a URL is valid. and still alive or if it's a 404 Not Found.
How to Get the Current Page URL
Sometimes, you might want to get the current page URL that is shown in the browser URL window.
How to use the LoadVars Class
The LoadVars class allows developers to have a better control of the external loaded data. There are many reason to use the LoadVars class intead of the old deprecated loadvariables and loadvariablesNum.
Get the Feedburner original link
Many websites use Feedburner to serve their RSS feed. The link from the Feedburner feed to the article is a Feedburner URL which then redirects to the original URL. The original URL is still contained in the XML for the feed in the element named <feedburner:origLink> and this can be parsed out using PHP's SimpleXML library, but it's not quite as simple as referring to ->feedburner:origLink because this will not work.
Enhancing User Experience with WordPress
This Chapter focuses on enhancing user experience and helps users make their blog a better place by focusing on the following areas:- Replacing the Next and Previous links by a paginator Highlighting searched text in search results Using the CSS sliding doors technique within WordPress Creating a dropdown menu for your categories Adding a breadcrumb to your theme Displaying related posts Display tabs on your sidebar
An Expandable Form Validation Class: Part 1
Learn how to create an expandable Form Validation Class, that once complete, you will able to use in any of your PHP scripts. The beauty of this Class is that it is expandable with ease. This means that once the base code of the Class is complete, you can easily configure it to validate different types of form data with virtually no changes. The extra configurations will only be limited to your programming knowledge.
Object Oriented Programming: Image Class
Create an image class, in this class there are 4 function: One to Upload; One to Resize; One to get a file extension and One to resize on the fly.
Form Handling in PHP
I am just gonna go through simple form handling with you, nothing too fancy.
How to create a gallery class
In this tutorial, we will create a gallery class, and also a template class that will work together with the gallery class.
Get the full URL of your page using PHP
Very often we need to have the ful URL of the page and use it somehow in our code, for example a dynamic script with social bookmarks or anything else we can think of. This can be done using Javascript but I prefer to use PHP since it's not based on the client side and it works with or without Javascript turned on in our browsers.
jQuery Contact form for your website
In this tutorial we show how to create a modern contact form that is linked by a simple text link and opens in a fancy Lightbox where all form handling, including reCAPTCHA validations, are processed by PHP and the jQuery Ajax function. After the form submission was successful we are using the PHP Class script PHPMailer to send the message via SMTP.
PHP Table Class
This is a class for generating HTML tables. It's kind of rough, but I thought somebody might want to do something with it.
Using curl to Query Remote Servers
curl is the client URL function library. PHP supports it through libcurl. To enable support for libcurl when installing PHP add --with-curl=[location of curl libraries] to the configure statement before compiling. The curl package must be installed prior to installing PHP. Most major functions desired when connecting to remote web servers are included in curl, including POST and GET form posting, SSL support, HTTP authentication, session and cookie handling.
An Expandable Form Validation Class: Part 3
In this final Part we will be coding some example validation rules and explaining how to use them. We will then go on and show how the final complete Class can be applied in a real working environment, so that you can use it in all your future scripts. At the end of this Part, you should have gained a complete understanding of how the Class operates, and proceed to expand on it with ease.
Handling errors
As coders, I'm sure we all know the value of good error handling. So I thought a quick post about how Codeigniter deals with those pesky errors would be a good post. The way I see it, there are 2 types of errors we have to work with. The ones which are displayed out in nice friendly text to your users, and the type which are hidden and shown only to you as the coder to figure out where something has gone wrong.
Clean way to call to multiple xmlrpc remote servers
I've got a class library in PHP. This class library is distributed in a several servers and I want to call them synchronously. The class library has a XMLRPC interface with Zend Framework XMLRPC server.
Get full web page URL from address bar
In this tutorial, you'll learn how to get current web page url from your web browser address bar using php script.
Extract domain, path etc from a full url
PHP's parse_url function makes it easy to extract the domain, path and other useful bits of information from a full URL. This can be useful for a variety of purposes, such as when spidering content from a website and needing to extract particular pieces of information from the links in the page.
PHP Redirect
A PHP Redirect automatically transfers a web user from one URL to another. For example, typing foo.com in the browser automatically transfers the user to another URL bar.com.
Intro To Object Oriented: Creating Your First Class
Introduction to object oriented programming (oop), create your very first php class.
Creating a bank_account Class
To demonstrate the use of a class, lets create one to model a bank account.A bank account has certain information associated with it, such as itsaccount number, the PIN number needed to access it, and its balance.
Creating a bank_account Class
To demonstrate the use of a class, lets create one to model a bank account.A bank account has certain information associated with it, such as itsaccount number, the PIN number needed to access it, and its balance.
Advance Pagination Class
This class will display the results of any MySQL table including all the fields and rows. It will work out how many fields there are and display the results accordingly
PHP and UML Class Diagrams
UML (Unified Modeling Language) is a mechanism for representing software in the form of diagrams. Essentially it allows to design our applications by drawing, and if the right tools existed, even generate code from the diagrams. In this article we'll look at how PHP code is represented in UML terms, via use of the the UML class diagram.
PHP Redirection
See how to redirect to another URL, while still allowing search engines to index your site.
PHP Classes - OOP
Most people are afraid of classes and refuse to see the use of them. I was, until I took a JAVA class, which requires the use of classes, and saw the actual beauty of them. Classes are really useful, they reduce the clutter of your code, and make updating a site very easy. Unfortunately, classes aren't as useful in PHP as in other languages, but I still like them. I'm going to use my site as an example, where I have the user_commands class, which handles all the users on the site (ie login, logout, session_ids, etc). It makes my code very neat and organized, and it really pays off when you need to make a change.
URL Verification
Do you have a big list of links in your database that you want to display but only want to show ones that are still in existance? Well theres a very easy method for doing so. All you need is the fsockopen() function. Here is an example.
Advanced Pagination Class in PHP
Now I am going to go through how to make an advanced pagination class in PHP.
Remove whitespace from string
I have been doing a lot of coding using the framework CodeIgniter lately so I have been creating many simple helper functions to perform different tasks. My most recent project involves creating PDF files with text from a database. The problem is that the text from the database is dirty, meaning that in a persons name there could be multiple spaces between the persons first and last name or even spaces at the end of their name. In dealing with legacy data that you cannot change but needs to be output correctly without those spaces you get creative. The below function should help solve this issue .
Building a Shopping Cart Class in PHP
An introduction to building a class in PHP using a shopping cart as an example.
Send this page to a friend
A php walkthrough that shows how to realize a useful php script to an url of your site via mail.
Convert links into clickable hyperlinks
A function to change an email address or URL into a clickable HTML hyperlink using eregi_replace.
PHP File Handling
We can use PHP to open files and manipulate the data contained within them.
Enhancing Dynamic Twitter Signature Images
In my last article we began putting together a solution that will allow us to display dynamic Twitter signature images in forum posts and emails. In this article well continue where we left off by adding the functions that will harness the power of GD to create the actual image.
 
Categories