Welcome Guest, Not a member yet? Register   Sign In
Optional parameter for controller
#4

[eluser]pickupman[/eluser]
In the actual function/method. Placing code in the constructor would be for things used throughout the entire controller.
Code:
function back(){
  $offset = $this->uri->segment(5,10);
}

I always put these at the top of the function/method. You can also pass uri segment default values by placing them in the arguments for the function
Code:
function at($third_segment = 'orders', $forth_segment = 'start', $fifth_segment = '10'){
  //Now each segment has a default value
}
The arguments need to be passed together in succession. (ie. you can just pass the 4th item, and not declare the ones before it.


Messages In This Thread
Optional parameter for controller - by El Forum - 07-22-2010, 10:59 AM
Optional parameter for controller - by El Forum - 07-22-2010, 11:22 AM
Optional parameter for controller - by El Forum - 07-22-2010, 11:26 AM
Optional parameter for controller - by El Forum - 07-22-2010, 11:39 AM
Optional parameter for controller - by El Forum - 07-22-2010, 11:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB