Welcome Guest, Not a member yet? Register   Sign In
Forum prototype - Constructive criticism requested.
#1

[eluser]TheFuzzy0ne[/eluser]
Hi everyone. I've spent weeks on this, and I'm still not convinced I have it right. I've practically designed a whole forum already, and then get pissed off and end up doing a rewrite. I'd be interested to see how everyone else would do this. I've opted to use objects rather than a model. I'd appreciate any pointers - something I could change, a method I should add, a different structure etc...

Here's the prototype, I think it's fairly self-explanatory, and obviously there will be more methods added eventually.

Code:
<?php

class Forum {
    
    var $id,
        $title,
        $description,
        $lft,
        $rgt;
    
    function Forum() {}
    
    function set_id() {} # Setting the id will reinitialize the object.
    function get_id() {}
    
    function set_title() {}
    function get_title() {}
    
    function set_description() {}
    function get_description() {}
    
    function set_lft() {} # Setting the lft will reinitialize the object.
    function get_lft() {}
    
    function set_rgt() {} # Setting the rgt will reinitialize the object.
    function get_rgt() {}
    
    function delete($forum_id=NULL) {} # Deletes this forum, and any forums/posts under it.
    function save() {} # Inserts/updates the database appropriately
    function _reset() {} # Resets the object.
    
    function move_up() {} # Moves the forum up one place within the confines of the parent forum.
    function move_down() {} # Moves the forum down one place within the confines of the parent forum.
    
    
    function get_posts($page_num) {} # retreives the posts from the forum
    function get_post($post_id) {} # Get's a single post from the database
    function add_post($post_obj) {} # Adds a post
    function mark_post_read($post_id, $user_id) {}
    function mark_forum_read($forum_id, $user_id) {}
    
    function delete_post($post_id) {} # Deletes a post
    function delete_all_posts($forum_id) {} # Deletes all posts under the specified forum
    function move_post($post_id, $forum_id) {} # Moves a post
}

class Forum_Post {
    
    var $id,
        $user_id,
        $date,
        $subject,
        $body;
        
    function Forum_post() {}
    
    function set_id($id) {} # Reinitialises the object.
    function get_id() {}
    
    function set_user_id($user_id) {}
    function get_user_id() {}
    
    function set_subject($subject) {}
    function get_subject() {}
    
    function set_body($body) {}
    function get_body() {}
    
    function set_date($date) {}
    function get_date() {}
    
    function _reset() {} # Resets the object
}

Although I use objects all the time, I don't think I use them the way I should, but I'd like to, which is why I want to try to start off on the right foot. When I say "how I should", I mean that I only ever seem to need a single object of any one type instantiated at anyone time (like a model, or library).


Messages In This Thread
Forum prototype - Constructive criticism requested. - by El Forum - 04-30-2009, 09:03 AM
Forum prototype - Constructive criticism requested. - by El Forum - 04-30-2009, 11:30 AM
Forum prototype - Constructive criticism requested. - by El Forum - 04-30-2009, 11:51 AM
Forum prototype - Constructive criticism requested. - by El Forum - 04-30-2009, 02:17 PM
Forum prototype - Constructive criticism requested. - by El Forum - 04-30-2009, 07:25 PM
Forum prototype - Constructive criticism requested. - by El Forum - 05-01-2009, 01:59 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-01-2009, 05:42 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-01-2009, 05:57 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-01-2009, 06:09 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-01-2009, 07:13 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-01-2009, 07:32 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-01-2009, 07:50 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-01-2009, 07:57 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-01-2009, 08:02 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-01-2009, 08:14 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-01-2009, 08:22 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-01-2009, 08:28 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-01-2009, 08:36 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-01-2009, 08:38 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-01-2009, 08:41 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-01-2009, 08:50 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-01-2009, 08:57 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-01-2009, 09:04 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-01-2009, 09:18 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-01-2009, 09:23 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-01-2009, 09:29 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-01-2009, 09:54 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-01-2009, 01:57 PM
Forum prototype - Constructive criticism requested. - by El Forum - 05-02-2009, 11:48 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-03-2009, 05:22 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-03-2009, 06:14 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-03-2009, 06:41 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-04-2009, 07:27 PM
Forum prototype - Constructive criticism requested. - by El Forum - 05-05-2009, 09:23 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-05-2009, 09:31 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-05-2009, 09:49 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-05-2009, 09:50 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-05-2009, 02:41 PM
Forum prototype - Constructive criticism requested. - by El Forum - 05-05-2009, 07:35 PM
Forum prototype - Constructive criticism requested. - by El Forum - 05-06-2009, 05:01 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-06-2009, 08:06 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-06-2009, 08:11 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-11-2009, 09:40 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-11-2009, 09:45 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-11-2009, 11:38 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-11-2009, 11:49 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-11-2009, 12:06 PM
Forum prototype - Constructive criticism requested. - by El Forum - 05-11-2009, 12:10 PM
Forum prototype - Constructive criticism requested. - by El Forum - 05-11-2009, 11:48 PM
Forum prototype - Constructive criticism requested. - by El Forum - 05-12-2009, 01:41 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-12-2009, 06:40 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-12-2009, 06:50 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-12-2009, 06:56 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-12-2009, 06:59 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-12-2009, 07:21 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-12-2009, 07:24 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-12-2009, 07:42 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-12-2009, 07:47 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-12-2009, 11:24 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-12-2009, 11:29 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-12-2009, 11:34 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-12-2009, 12:04 PM
Forum prototype - Constructive criticism requested. - by El Forum - 05-12-2009, 01:19 PM
Forum prototype - Constructive criticism requested. - by El Forum - 05-12-2009, 02:23 PM
Forum prototype - Constructive criticism requested. - by El Forum - 05-12-2009, 02:31 PM
Forum prototype - Constructive criticism requested. - by El Forum - 05-12-2009, 02:34 PM
Forum prototype - Constructive criticism requested. - by El Forum - 05-12-2009, 02:45 PM
Forum prototype - Constructive criticism requested. - by El Forum - 05-13-2009, 04:36 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-13-2009, 05:13 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-13-2009, 02:39 PM
Forum prototype - Constructive criticism requested. - by El Forum - 05-15-2009, 08:45 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-15-2009, 08:53 AM
Forum prototype - Constructive criticism requested. - by El Forum - 05-15-2009, 09:08 AM
Forum prototype - Constructive criticism requested. - by El Forum - 07-17-2011, 09:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB