CodeIgniter Forums

Full Version: How URI segments can be replaced by any string
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Unknown[/eluser]
Hi,

I'm not so adept in CI environment. I'm in a problem to replace/rename URI segments with any particular string. How I can do this ? Here is my URI:

http://localhost/toolipia/index.php/jobs

I wanna replace 'jobs' with the string say 'products'. In the above URI jobs is the name of a class name of CI architecture (domain/class/function/ID).



Best Regards
Younus, Bangladesh

El Forum

[eluser]Tom Glover[/eluser]
[quote author="unus" date="1201446370"]Hi,

I'm not so adept in CI environment. I'm in a problem to replace/rename URI segments with any particular string. How I can do this ? Here is my URI:

http://localhost/toolipia/index.php/jobs

I wanna replace 'jobs' with the string say 'products'. In the above URI jobs is the name of a class name of CI architecture (domain/class/function/ID).



Best Regards
Younus, Bangladesh[/quote]

Have your Read the User Manual: URL's
Quote:Enabling Query Strings

In some cases you might prefer to use query strings URLs:
Quote:index.php?c=products&m=view&id=345

CodeIgniter optionally supports this capability, which can be enabled in your application/config.php file. If you open your config file you'll see these items:
Code:
$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:
Quote:index.php?c=controller&m=method

Quote:Please note: 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.

Hope this Helps.