Reputation: 425
Im going through codeigniter-3 tutorial and I dont fully understand what they mean with this:
"If you are using the URI Routing feature, the segments passed to your method will be the re-routed ones."
Its under "Passing URI Segments to your methods"
code displayed:
<?php
class Products extends CI_Controller {
public function shoes($sandals, $id)
{
echo $sandals;
echo $id;
}
}
http://www.codeigniter.com/user_guide/general/controllers.html
Are the segments the arguments passed in to the function and what do they mean with they will be re-routed? I checked the URI Routing feature but still dont understand. Can anyone can explain what they mean?
Upvotes: 0
Views: 409
Reputation: 775
Well in your case, I would suggest you to read on URI Routing, to get more information regarding what's going on.
But as to answer your questions, if you are for example defining new URI's to change your URL as you like, then by calling shoes($sandals, $id)
, you will get the parameters that were manipulated in the re-routing process, and not the original ones.
In other words, if you have tried re-routing your URI's
from index.php/Product/shoes/blue/10 to index.php/Product/shoes/green/10
then by calling shoes($sandals, $id)
you will get green and 10, as you mentioned, note the blue will not be displayed then.
Upvotes: 2