Welcome Guest, Not a member yet? Register   Sign In
Im just confused how to build this URL (easy question for you guys, I think)
#3

[eluser]TWP Marketing[/eluser]
Since your second URL segment, "administration", may be used for two (or more) functions, you can set up a conditional statement in the administration method code:

Your Controller named Infosystems"
Code:
...
function administration($func="admin")
{
if( $func == "user_management" )
{
  $this->user_management(); // call the user management method in this controller
  return; // leave, done with user_management function
}
// put the default administation stuff here
}

function user_management()
{
// do you user management stuff here
}
...

Now if you use this URL:
Code:
http://www.example.com/infosystems/adminstration
The value of the third URL segment is blank and the controller function will use the default value for $func = "admin" (or whatever you want to make it).

If you use this URL:
Code:
http://www.example.com/infosystems/adminstration/user_management
The value of $func will be set to the third URL segment "user_management"
and the conditional statement will call the user_management method and then return.

NOTE: CI will pass the third URL segment as a parameter of the second URL segment, it's built in to CI.


Messages In This Thread
Im just confused how to build this URL (easy question for you guys, I think) - by El Forum - 07-26-2012, 01:24 PM



Theme © iAndrew 2016 - Forum software by © MyBB