Member Avatar for iamthwee

hi guys... what is the simplest php forum to add to my cms. I'm struggling finding something simple which separates the db code and view(html)

Member Avatar for iamthwee

bumppppp.

Member Avatar for iamthwee

I know I'm a bad boy.

You know what I've downloaded as many 'lite' forums as I could and EVERY single one is way too bloated for me to reverse engineer.

So I thought fuck it I'll write my own, I'm following a very php forum tut.

Will post back my progress. Thanks for the advice.

Member Avatar for iamthwee

I've read a few tuts and this is my db schema.

It appears to work

 users
+-------+-------+----------+-----------+
| userid| name  | no_posts |admin_level|
+-------+-------+----------+-----------+

topics
+----------+------------+
| topic_id | topic_name |
+----------+------------+

posts
+--------+----------+---------+--------+---------+
| postid | userid   | content | date   | topic_id|
+--------+----------+---------+--------+---------+

I only have ONE forum so I don't need a category table. Thoughts?

Member Avatar for diafol

The no_posts will be non-normalized.
I'd add a status to the posts table so you can admin it (e.g. delete) if you want to keep it but not display it.
Your users table will need to be fullblown if you intend on logins (pw, email etc).
It may be convenient to add user_id to the topics table, but shouldn't be essential.

As you want to keep it lean, you can forget the read/unread and other bloat.

Member Avatar for iamthwee

The no_posts will be non-normalized.

Sorry, didn't understand that. Can you clarify.

Your users table will need to be fullblown if you intend on logins (pw, email etc).

Yeah I've already got that up and running. Just keeping it dead simple so I can get my head around the basics of the forum.

ta

Edit

no_posts should read no_of_posts as in the number of posts.

Member Avatar for diafol

Sorry, didn't understand that. Can you clarify.

Normally, you wouldn't have a column like this as it could be calculated from the posts table (e.g. ... count ... where user_id = ...), but that can use up a lot of resources, so it may be reasonable to use a column like this.

Member Avatar for iamthwee

Ok gotcha.

Member Avatar for iamthwee

K, can someone please comment on my super lite vanilla forum system written in Codeigniter.

This is a superlight forum written by iamthwee in codeigniter

Useage instructions

1. Create an empty database called 'forums' in your phpmyadmin
2. Import the database 'forums.sql'
3. Edit the application/config/database.php for your db settings
4. Open a webbrowser and type in localhost:/forums-7

DISCLAIMER OF WARRANTY
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR
IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF QUALITY, PERFORMANCE,
NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.

LIMITATIONS OF LIABILITY
YOU ASSUME ALL RISK ASSOCIATED WITH THE INSTALLATION AND USE OF THE SOFTWARE.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS OF THE SOFTWARE BE LIABLE
FOR CLAIMS, DAMAGES OR OTHER LIABILITY ARISING FROM, OUT OF, OR IN CONNECTION
WITH THE SOFTWARE. LICENSE HOLDERS ARE SOLELY RESPONSIBLE FOR DETERMINING THE
APPROPRIATENESS OF USE AND ASSUME ALL RISKS ASSOCIATED WITH ITS USE, INCLUDING
BUT NOT LIMITED TO THE RISKS OF PROGRAM ERRORS, DAMAGE TO EQUIPMENT, LOSS OF
DATA OR SOFTWARE PROGRAMS, OR UNAVAILABILITY OR INTERRUPTION OF OPERATIONS.
Member Avatar for diafol

How about running an installation routine instead of asking users to do manual stuff?

Member Avatar for iamthwee

good idea, perhaps I'll use dbforge on next release but just wanted to get an overall idea if I'm moving in the right direction to be honest.

I want to create an absolute minimum forum, no bloat no heavy stlying, or fancy js, just controller and model logic.

Thoughts on current codebase/ bugs issues?

I would be all over this thread if I didn't have the flu. My head is way too cloudy to think.

DaniWeb was built on a very agile model where we started off with just the bare bones functionality, then skinned it, and then continuously built on top of that. The four basic components are articles, posts, members, and forums. You can get a good undertanding of our schema by playing around with our API.

Actually, on second thought, yes, our API really does give a really good example of the design for a bare bones forum system.

Member Avatar for iamthwee

k will look at the api tomorrow as it's bed time. If anyone gets a chance to test it would be much appreciated.

Remember this is no full forum cms, just an addon to my existing cms which does other things. It's real basic mainly just the business logic.

Member Avatar for iamthwee

Please find attached updated ultralite forums-7 code.

This is a superlight forum written by iamthwee in codeigniter

Useage instructions

1. Change to your mysql details in applications/config/database.php leave the db as blank
2. Open a web browser and type localhost/forums-7 into the url
3. Enjoy


[Bug fixes]
-Added form validation to prevent empty submits
-Added xss prevention by using my_html_escape
-Remove nl2br in my_html_escape as causing a bug
-Added a search facility
-Added install script

DISCLAIMER OF WARRANTY
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR
IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF QUALITY, PERFORMANCE,
NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.

LIMITATIONS OF LIABILITY
YOU ASSUME ALL RISK ASSOCIATED WITH THE INSTALLATION AND USE OF THE SOFTWARE.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS OF THE SOFTWARE BE LIABLE
FOR CLAIMS, DAMAGES OR OTHER LIABILITY ARISING FROM, OUT OF, OR IN CONNECTION
WITH THE SOFTWARE. LICENSE HOLDERS ARE SOLELY RESPONSIBLE FOR DETERMINING THE
APPROPRIATENESS OF USE AND ASSUME ALL RISKS ASSOCIATED WITH ITS USE, INCLUDING
BUT NOT LIMITED TO THE RISKS OF PROGRAM ERRORS, DAMAGE TO EQUIPMENT, LOSS OF
DATA OR SOFTWARE PROGRAMS, OR UNAVAILABILITY OR INTERRUPTION OF OPERATIONS.

just downloaded the file :).

Member Avatar for iamthwee

Hmm, noticed a few bugs in there.
To be fixed.

OK, after a lot of thought I've decided I want to ammend my topic table to:

+---------+----------+---------+----------+---------------+-----------+
|topicid  | topicname| author  | replies  |last_reply date| reply_name|
+---------+----------+---------+----------+---------------+-----------+

Might not be normalised but the trade off in reduced complex sql queries seems better. Designing a forum is no easy task! It seems.

Member Avatar for iamthwee

Looks like I was wrong keeping it normalised was easier. Tables remain the same no ammends.

Small updates fixed bugs and added a delete post/thread option.

Member Avatar for iamthwee

Update:

-Restructed table to how I initially set it to be
-Fixed all known bugs
-Post count now works perfected
-Added a paginate option for long-ish threads

To do:
-Add a simple logon to validate
-Add an admin panel
-Query posts by users
-Properly separate controller and views (no echos in views)
-Reorder threads so most recent gets bumped to the top

Please if anyone gets a chance to test and debug would me most grateful. Or if anyone can simplify my SQL am willing to take pointers!!

Member Avatar for diafol

This is CI? I noticed you had about a million files.

Please if anyone gets a chance to test and debug would me most grateful. Or if anyone can simplify my SQL am willing to take pointers!!

I would have a look - if you posted any relevant code / SQL in this thread.

Member Avatar for iamthwee

Yes this is codeigniter.

Unfortunately I can't post any code here as it would be nonsensical as the project must be evaluated altogether.

Thanks.

Member Avatar for diafol

So in other words, we have to install it?

Member Avatar for iamthwee

Correct, if you are worried about loss of data, you could set up a virtual machine and do tests. However, there are no delete scripts in the file, or deletes to databases.

The script should only create a database called 'forums' and insert the relevant tables.

I've put a disclaimer just in case. But I think you should be good to go.

Member Avatar for diafol

Sorry, in that case it's more time than I've got at the moment.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.