Welcome Guest, Not a member yet? Register   Sign In
Parameters to default controller
#1

[eluser]ixxalnxxi[/eluser]
Hello All,

I was wondering whether it was possible to pass parameters to the default controller without having to make another controller to accept parameters.

When I currently try to send my default constructor a parameter, it associates the uri segment with a controller. Any help is appreciated, thanks.
#2

[eluser]TheFuzzy0ne[/eluser]
Please could you be more specific? Any extra parameters will not be passed to the constructor, but rather the index() method if it exists. Please could you give an example of a URL you'd want to use, and what controller/method you'd expect it to call?
#3

[eluser]ixxalnxxi[/eluser]
Sure,

I've left my default controller as welcome. If I would like to send a parameter to welcome's constructor, it would normally be

www.mysite.com/param_to_send

However this parameter is interpreted as a controller.
#4

[eluser]jedd[/eluser]
[quote author="ixxalnxxi" date="1243393649"]Sure,

I've left my default controller as welcome. If I would like to send a parameter to welcome's constructor, it would normally be

www.mysite.com/param_to_send[/quote]

This is not strictly true. If you wanted to send a parameter to welcome's index method then I can see how you might briefly assume that your URL would facilitate this.

Briefly because how could CI possibly know if you want the controller called param_to_send, or the method of welcome's called param_to_send or the welcome's index method to take it as the first parameter.
#5

[eluser]TheFuzzy0ne[/eluser]
Are you wanting to redirect all requests to a single controller method? You can use a route for this.




Theme © iAndrew 2016 - Forum software by © MyBB