OK. Number of left_hand route arguments mustequal number of right_hand arguments ... so:
here is your fix:
$route[’:any/:any’]=“welcome/page_lookup”;
essentially will take a URL http://yourdomaindotcom/fred and invoke the page_lookup method of the welcome controller class. Presumably you would then use $this->uri->segment(1) to retrieve the page named ‘fred’ from the table of your choice.
There you have it.
I had solved this a different way. Thanks for you help.
I don’t really recommend anyone doing this…ever. Just found out why this never crossed my mind. This construct sort of throws all the flexibility of CI on the floor.
Would be better to come into the default controller and branch from there the way CI is designed to operate.
Let’s start by commenting out the load->scaffolding call from the constructor for now.
I confirmed that only ONE :any wild card is required, so let’s remove the first :any and the slash, back to your original code:
[’:any’]
The php file named welcome_message.php does actually exist in your views directory, right?
What I’m eluding to is ... are you including the index.php or have you hacked your .htaccess file correctly to allow yourself to exclude it. Just assumed earlier you had taken care of that.
Using PHP5.2.5 and following with a completely clean build of CI it works flawlessly. You have some fundamental problem that has you tweaked and I can’t figure…
Just create a new controller or a function in your welcome controller and you’ll not be able to reach it. You’ll get the function or controller name printed.
I think there should be somehow a first check if function or controller exists.
OH!! I’ve misunderstood along then. Of course you cannot do that. You’ve told CI explicitly to ignore all other requests for methods within the ‘Welcome’ class since you said “intercept calls to :any” method. So what this does is “reroute” the call (in my example above) to the ‘test_me’ method and then echo’s the string if finds at the location of URI segment 1. CI is doing exactly what you are asking it to do.
You must handle everything within your method call (test_me my example).
It does. The question now how we can first check if there are controllers or methods with that name first ($this->uri->segment(1)), if so, we execute the controller or method normally otherwise test_me handle the job.