Home arrow PHP arrow Developing a Discussion Forum in PHP with Recursion

Developing a Discussion Forum in PHP with Recursion

If you’re interested in learning how to use recursion in PHP, look no further. Welcome to the third (and last) tutorial of the series “Recursion in PHP.” In three parts, this series walks through the fundamentals of recursive functions in PHP, in addition to explaining how to define and utilize recursive methods in object-based applications.

TABLE OF CONTENTS:
  1. Developing a Discussion Forum in PHP with Recursion
  2. Getting started with the forum: defining the structure of the MySQL database table
  3. Processing forums threads: defining the "ThreadProcessor" class
  4. Displaying the forum: looking at the "fetchTitles()," fetchMessages()" and "createThreadForm()" methods
  5. The discussion forum in action: putting the "ThreadProcessor" class to work
By: Alejandro Gervasio
Rating: starstarstarstarstar / 15
May 15, 2006

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Introduction

As you'll probably recall, over the previous article I drew the general guidelines for defining and using recursive methods inside PHP classes. Because a method is simply a function that belongs to a particular class in an object-based development environment, creating recursive methods doesn't differ considerably from building regular recursive functions.

Provided that you defined the appropriate logic of a recursive method, all you have to remember is to include the popular "$this->" pointer, followed by the method's name, at the point where the method calls itself. As you can see, this process is really straightforward and easy to grasp.

After covering in detail how to define recursive method and functions, the question is: what comes next? Luckily, there's vast terrain to explore with reference to using recursion in PHP. As I said in previous articles of this series, recursion can be used in cases where a specific tree structure or a linked list needs to be navigated, in order to display, add, delete or edit its values. It's exactly for that reason that this last article will be focused on building an extensible discussion forum, which precisely uses a tree structure (implemented on a single MySQL database table) for displaying forum messages and adding new posts.

Of course, using the core logic of this forum as a starting point, you can experiment by adding more features to the overall application and build a more complex discussion forum. This can be integrated with your existing PHP applications, or eventually added to future ones.

Are you ready to start learning how to build a discussion forum in PHP? Right, let's do it together.



 
 
>>> More PHP Articles          >>> More By Alejandro Gervasio
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: