Default parameters for controller functions |
[eluser]chaotiq[/eluser]
Can I give a default parameter for controller functions and then override with a uri? Consider the following code. Code: Class My_controller extends Controller{ If I call the function without giving it a parameter the first part of the if statement works as intended. However, if I try to go to: http://mysite.com/index.php/my_controlle...nction/213 I would expect the 213 to override the default of 0 and the else should run. When I try this the first part of the if statement still runs. Am I thinking about this wrong? [Edit: formatting]
[eluser]danmontgomery[/eluser]
Works for me: Code: class test extends Controller { /test/my_function Quote:$var is 0 /test/my_function/213 Quote:$var is 213
[eluser]chaotiq[/eluser]
It does work. Thank you for testing it and your time. I misspelled one letter and one of my functions was not returning the right data. I feel ashamed. :roll: Thanks again for testing it out.
|
Welcome Guest, Not a member yet? Register Sign In |