Page 1 of 2 1 2 LastLast
Results 1 to 10 of 18

Thread: Write a Forum from Scratch!

  1. #1
    おはようございます klange's Avatar
    Join Date
    Dec 2006
    Posts
    3,028

    Write a Forum from Scratch!

    Hey, you read this: I had completely forgotten about this thing, I'll do it this week (not now, it's late >_>) okay?

    Introduction

    Alright, so, I felt I'd write a tutorial on how to write a discussion forum from scratch. I'm going to do this in multiple installments, so bear with me. I'll only go into the "what you need" for today, and then move into the basics tomorrow. Hopefully by next Tuesday this tutorial will be done...

    Tools Required
    - PHP 5
    - Apache or similar (I'm not going to show you how to set it up)
    - MySQL
    - MySQL GUI Tools or similar package (I like the cross-platform Administrator and Query Browser, good solid tools, and I'll be using them in my examples)
    - Notepad++, Gedit, or other similar editor

    If you're not up to the task of setting this stuff up and don't have your own hosting somewhere, you can get a package like XAMPP. It's easy to set up on Windows and Linux and provides a simple interface to get your server running with everything you need.

    Structure of this Tutorial
    We'll first explore the basic design of a simple forum and look at the aspects we want to replicate. We'll then cover the basics of our MySQL table structures and how they will work in our code. Then we'll get to work on the actual coding in PHP. Finally, we'll style the forum with some CSS. Our final product will be a flat forum with user accounts, including avatars, signatures and bbCode.

    Part I: Forum Basics
    Let's look at the forum we're on now: vBulletin is primarily a flat-thread forum with categories, boards and threads - the same model we'll be using. This has remained the dominant layout for community forums for years. The other layout you tend to find is nested tree replies, but it's very complicated and we won't get into it.

    Category
    _Board
    __Thread
    ___Post
    ___Post
    __Thread
    ___Post
    ___Post
    _Board
    __Thread
    ___Post
    ___Post
    __Thread
    ___Post
    ___Post
    Category
    _Board
    __Thread
    ___Post
    ___Post

    Part II: SQL Tables
    SQL is the basis for data storage on the Internet. Forums, CMSes, blogs - they all store data, and most all of them do it with SQL. There are a few different forms of SQL: MySQL, MSSQL, PL/SQL, etc., but MySQL is the most popular, mostly because it is free and open-source.

    Our SQL is fairly simple, and you'll want to get your editor ready and make these now:
    categories
    id (int, primary key, auto-increment)
    name (string)
    boards
    id (int, primary key, auto-increment)
    name (string)
    perms (int, default=0, not-null)
    threads
    id (int, primary key, auto-increment)
    title (string)
    author (int, not-null)
    content (TEXT)
    posts
    id (...)
    author (int, no-null)
    content (TEXT)
    users
    id (...)
    name (string)
    level (int, default=0, not-null)
    signature (string)
    avatar (string)

    (I'll put up SQL that generates these tomorrow; the rest of the tutorial should be up later today)
    Last edited by klange; August 2nd, 2009 at 08:54 PM.

  2. #2
    is pointing at his post Evil_Monkey's Avatar
    Join Date
    Jun 2008
    Location
    In your closet!
    Posts
    292

    Re: Write a Forum from Scratch!

    Cool, looking forward to seeing this.

  3. #3
    おはようございます klange's Avatar
    Join Date
    Dec 2006
    Posts
    3,028

    Re: Write a Forum from Scratch!

    Oops, I wss supposed to start this on monday... I'll do it "today" I guess.

  4. #4
    Free Kantanomo English Mobster's Avatar
    Join Date
    Nov 2008
    Location
    Southern California
    Posts
    1,932

    Re: Write a Forum from Scratch!

    This sounds really interesting. I'll be looking forward to seeing this!

  5. #5

    Re: Write a Forum from Scratch!

    Requesting Update

  6. #6
    おはようございます klange's Avatar
    Join Date
    Dec 2006
    Posts
    3,028

    Re: Write a Forum from Scratch!

    Quote Originally Posted by Kalub View Post
    Requesting Update
    I completely forgot about this I'll write it this week, I've got more time to do the Cerebrum things I needed to do, so it should be fine.

  7. #7
    The One and Only TheGhost's Avatar
    Join Date
    Aug 2006
    Location
    San Francisco, CA
    Posts
    2,727

    Re: Write a Forum from Scratch!

    Do it in EJB 3.0 and I'll give it a read ;p

    jk I'm still interested in reading this

  8. #8
    Could've Moved Mountains
    Join Date
    Sep 2006
    Location
    RIT
    Posts
    3,144

    Re: Write a Forum from Scratch!

    Same, considering I'm working through learning PHP and MySQL right now .

  9. #9
    おはようございます klange's Avatar
    Join Date
    Dec 2006
    Posts
    3,028

    Re: Write a Forum from Scratch!

    Don't worry guys, I'm working on the tutorial, but don't want to post it until it's done.

  10. #10
    Neanderthal Dwood's Avatar
    Join Date
    Sep 2008
    Location
    Wouldn't u like to know?
    Posts
    4,189

    Re: Write a Forum from Scratch!

    Quote Originally Posted by AdmiralBacon View Post
    Don't worry guys, I'm working on the tutorial, but don't want to post it until it's done.


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •