Saturday, July 7, 2012

Codeigniter php frameworks: codeigniter URLs part 2

Codeigniter php frameworks will be next to part two of codeigniter URLs. If you have not read the part one of codeigniter URLs, please follow this link to read it. Okay back to the lesson, now we talk about Adding a URL suffix. To active it you can find this configuration at config/config.php, you can specify that will be added to all URLs generated by codeigniter. for example, if the URL is example.com/index.php/products/view/shoes, you can optionally add a suffix, like .asp, making the page appear to be of a certain type like this example.com/index.php/products/view/shoes.asp.

And the last lesson of codeigniter URLs is Enabling Query Strings, in some cases you might prefer to use query strings URLs like this index.php?c=products&m=view&id=345. Codeigniter optionally supports this capability, which can be enabled in your application/config.php file. Codeigniter php frameworks will be show you the config file preview. The preview will be like this.

$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';

If you change “enable_query_strings” to TRUE this feature will become active. Your controllers and functions will then be accessible using the “trigger” words you’ve set to invoke your controllers and methods like this index.php?c=controller&m=method. I think enough for this post of codeigniter URLs, see you in the next post in Codeigniter php frameworks.

Please note this, If you are using query strings you will have to build your own URLs, rather than utilizing the URL helpers (and other helpers that generate URLs, like some of the form helpers) as these are designed to work with segment based URLs.

This post of Codeigniter php frameworks: codeigniter URLs part 2 is references from http://codeigniter.com/user_guide/general/urls.html.

No comments:

Post a Comment