Welcome Guest, Not a member yet? Register   Sign In
Handling controller parameters
#3

I usually define all of the permitted URL parameters on the method definition, with default values set for optional parameters. If it's possible for the order of the parameters to change, I might use logic similar to what you've shown to reassign the values to the correct variables. However, I try to avoid that level of complexity whenever possible.

As InsiteFX inferred, the second parameter of $this->uri->segment() can be very useful for handling optional parameters, though the code you've shown here wouldn't benefit from that.
Reply


Messages In This Thread
Handling controller parameters - by aspz - 07-11-2016, 07:31 AM
RE: Handling controller parameters - by InsiteFX - 07-11-2016, 11:07 AM
RE: Handling controller parameters - by mwhitney - 07-12-2016, 07:35 AM
RE: Handling controller parameters - by PaulD - 07-12-2016, 09:12 AM
RE: Handling controller parameters - by aspz - 07-12-2016, 11:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB