question regarding default view |
[eluser]Unknown[/eluser]
Hi, I am writing an application that has urls like: http://domain.com/profiles/view/3/ This would view the profile with id = 3. I have this working. Here's a snippet of the controller: (yeah, it's dirt simple) Code: function view($id) When I load : http://domain.com/profiles/view/, I get an error, because id is missing. How do I set the behavior when someone does not include an id? Thanks.
[eluser]xwero[/eluser]
Code: function view()
[eluser]gtech[/eluser]
you can also default id to NULL Code: function blog_view($id=NULL) be careful VIEW is a reserved word in php4 I read a post where someone had a problem with naming the functions view as it worked on php5 their locahost but not php4 where there server was hosted.
[eluser]BravoAlpha[/eluser]
I've been using something like this: Code: function view( $id=FALSE )
[eluser]Unknown[/eluser]
excellent, thanks for the suggestions and for not laughing at my question! |
Welcome Guest, Not a member yet? Register Sign In |