Welcome Guest, Not a member yet? Register   Sign In
Can i pass params into a controllers __construct() function?
#2

[eluser]LifeSteala[/eluser]
Hello,

Please remember to place code within builtin CODE tags for better readability.

To accomplish your goal, ensure you're URI Class Library is loaded and you can do the following:

Note: code is untested.

Code:
public function __construct()
{
  parent::__construct();
  
  // Replace segment (n)
  $id = $this->uri->segment(n);

  die($id);
}

Hope that helps.


Messages In This Thread
Can i pass params into a controllers __construct() function? - by El Forum - 05-24-2012, 05:31 PM



Theme © iAndrew 2016 - Forum software by © MyBB