user18334
user18334

Reputation: 6783

Subfolders in CodeIgniter

I'm new to CodeIgniter, and I need some help. I'd like to implement the following:

I've already created the admin object and secured it. Do I have to create a profile function under admin, and work with the URI to process accordingly? Is there a better way?

Upvotes: 3

Views: 2758

Answers (2)

user18334
user18334

Reputation: 6783

I found the solution I was looking for: http://www.clipmarks.com/clipmark/75D02C9E-3E76-483E-8CCE-30403D891969/

Thanks, Christian D, I like your solution better than mine. I'm going with it.

Upvotes: 1

Christian Davén
Christian Davén

Reputation: 18237

This is not such a good idea.

If you want to implement those URLs, you need two controllers:

  1. Profile, with the function index
  2. Admin, with the function profile

In Admin, the profile function has to read the first argument (create/edit/[userid]) and then do something accordingly. (You also must make sure that no user can call himself "create" or "edit".)

I would instead use only one controller with the functions show, edit, and create (or add). Much easier. Then you would get these URLs:

  • http://localhost/profile/show/johndoe
  • http://localhost/profile/edit/johndoe
  • http://localhost/profile/create/johndoe

Upvotes: 8

Related Questions