Welcome Guest, Not a member yet? Register   Sign In
URI Mapping to another controller
#3

[eluser]Unknown[/eluser]
[quote author="douweegbertje" date="1331139399"]
you have to understand that your controller works like this:


example.com/admin/

Code:
<?php

class Admin extends CI_Controller {
  
  
}

example.com/admin/users

Code:
<?php

class Admin extends CI_Controller {
  
  public function users()
  {
  //blaat
  }
  
}

and:
example.com/admin/users/10

Code:
<?php

class Admin extends CI_Controller {
  
  public function users($userId)
  {
  //blaat
  echo $userId;
// will result in echo 10
  }
  
}
[/quote]

Yes, I do understand this.
But it did not make sense if I wrote all my code in to "admin" controller, Right ?

I have separate controller (in this case "users") that deal with managing users data.
But I did not wish the user knew it was accessible through
Code:
example.com/users
for security reasons. ( yes, I did use session to protect the pages from unauthenticated access)

It would be great to be able to map the calls to the separate controller if possible, so the code will be less clutter and easy to maintain.
( Sorry, first time PHP coder, things can get really messy in codes. Tongue )



Messages In This Thread
URI Mapping to another controller - by El Forum - 03-07-2012, 09:44 AM
URI Mapping to another controller - by El Forum - 03-07-2012, 09:56 AM
URI Mapping to another controller - by El Forum - 03-07-2012, 10:05 AM



Theme © iAndrew 2016 - Forum software by © MyBB