FalconFour.com | Home | Code | Comments System
My mind is only slightly larger than my hard drive.
FalconFour.com
- Projects
- Blog / Personal
- Code
-- Comments System
-- Navigation Structure
-- SFV checker
-- Stats Sig/Av
-- 32-character file rename batch file
-- Simple Message Storage
- Privacy Policy

Comments System

It would be a good idea to put your helmets on now. This could get interesting.

First, let's start with the base. This piece of scriptness will spit out the comments for a given context, or just return if nothing is found (no comments).

Warning: highlight_file(../functions/comment_grab.php): failed to open stream: No such file or directory in D:\Web\falconfour\CODE.PHP on line 37

Warning: highlight_file(): Failed opening '../functions/comment_grab.php' for highlighting in D:\Web\falconfour\CODE.PHP on line 37

That code above is being taken out of hostfile's code in realtime, so I can't dumb it down or comment it up without changing what the site uses. But you can see how it reads the database - tables named hostfile_comments and hostfile_users containing each one's information. You can also see the column names each one uses. The structure my database uses is as follows:
hostfile_users
id (smallint) - User ID
name (varchar(16)) - Username
pri_img (varchar(41)) - Filename of primary image hosted on Hostfile.org (modify code to suit for avatars)
alt_name (varchar(64)) - Subtitle
donor (tinyint(4)) - Donor status, 0 or 1.
hostfile_comments
id (int) - Comment ID
context (text) - The context for the post (what topic, file, user, etc)
uid (mediumint) - Who posted the comment
text (text) - The actual comment itself

So to grab comments for something, just echo comment_grab('context','start','asc'). Context is the identifier of that page, start is the number you want to begin at (e.g. page 2 = #20), and asc is if you want to reverse the order of postings (can be left unset).

Now
falconfour.com / v4.0 / (c)2007-2013 Matt Falcon /