Search code examples
phpcodeignitercodeigniter-url

making category link in codeigniter


i have a project and i separated items according to their character. For example: Smartphone, Television, Car eg..

i have link for each of them and i want to show them on different pages

in codeigniter structure is like: websitename.com/controller_name/function_name/argument_name

i can make it now in this way: websitename.com/main/category/category_name

but i want to make it in this way:

websitename.com/smartphone
websitename.com/television
websitename.com/car

how can i make it ?? thank you


Solution

  • You can create a separate Controller for each category. All the controllers will load the same View and the same Model in the index function with different arguments.

    Or you can remap the URL with URI Routing.
    https://ellislab.com/codeIgniter/user-guide/general/routing.html