Welcome Guest, Not a member yet? Register   Sign In
Restrict access to MY_Controller functions
#2

[eluser]mddd[/eluser]
If you want a controller method to never be available to the public (that is: you can only call it from within your own code) you can start the name with a _. CI will not make the method available to be called from the URI.
Note: this has nothing to do with being in a controller or in MY_Controller.

Like this:
Code:
function _set_cookies()
{
  // this code can NOT be called like www.example.com/_set_cookies.
}

function other_function()
{
  // this can be called through www.example.com/other_function
  // and from here you can call your other method
  $this->_set_cookies()
}


Messages In This Thread
Restrict access to MY_Controller functions - by El Forum - 08-13-2010, 12:37 AM
Restrict access to MY_Controller functions - by El Forum - 08-13-2010, 12:49 AM
Restrict access to MY_Controller functions - by El Forum - 08-13-2010, 02:49 AM



Theme © iAndrew 2016 - Forum software by © MyBB