Welcome Guest, Not a member yet? Register   Sign In
Can you suggest a better URI vs CRUD system for a forum?
#1

[eluser]nullsys[/eluser]
Hi!
I'm hoping you can help.
I'm considering the best way to present a forums' URL, vs Controller setup.
Here is what I'm thinking:

Code:
// Gets all categories
site.com/forum/

// Gets topics in the "dog" category
site.com/forum/dogs

// Gets all posts in the "huskie" topic
site.com/forum/dogs/huskie


//Create, edit and delete examples
site.com/forum/create/category
site.com/forum/create/topic
site.com/forum/create/post

site.com/forum/edit/category/cat_id
site.com/forum/edit/topic/topic_id
site.com/forum/edit/post/post_id

site.com/forum/delete/category/cat_id
site.com/forum/delete/topic/topic_id
site.com/forum/delete/post/post_id

// View single post
site.com/forum/view/post_id

Only the post_id will be numeric.

My problem is this:
Should I follow the standard CRUD format in the controller, and do the following for each create, retrieve, update and delete:

Code:
public function create() {
if ($this->uri->segment(3, 0) === "category") {
//Create category
}
if ($this->uri->segment(3, 0) === "topic") {
//Create topic
}
if ($this->uri->segment(3, 0) === "post") {
//Create post
}
}

I feel this would work, but I can't help feeling there is a more "codeigniter" way, using Routes or some such.

Any feedback, suggestions or the likes would be greatly appreciated!
Thank you.


Messages In This Thread
Can you suggest a better URI vs CRUD system for a forum? - by El Forum - 06-20-2012, 11:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB