Tuesday, July 10, 2012

Codeigniter php frameworks: controllers part 3

Codeigniter php frameworks will be go to the part 3 of controllers. You have to read the previous part to follow this post. Okay, now let’s talk about passing URI segments to your function. If your URI contains more than two segments they will be passed to your function as parameter. For the example, let’s say you have a URI like this example.com/index.php/products/shoes/sandals/123.


Your function will be passed URI segments number 3 and 4 (“sandals” and “123”). To easy learning, Codeigniter php frameworks will be show you the example of function who have the passing URI segments.


<?php

class Products extends CI_Controller {

public function shoes($sandals, $id) {

echo $sandals;

echo $id;

}

}

?>


Before closing this part of controllers, I have important things about this feature. If you are using URI Routing (will be discuss in another post) feature, the segments passed to your function will be the re-routed ones. Okay I thing enough for this part of controllers, keep updated with post of Codeigniter php frameworks.


This post of Codeigniter php frameworks: controllers part 3 is references from http://codeigniter.com/user_guide/general/controllers.html.


For information, Codeigniter php frameworks suggest you to follow this blog, if you interested with codeigniter, because write the post is references from codeigniter user guide.

No comments:

Post a Comment