Alexandex Grigorean
Alexandex Grigorean

Reputation: 39

Codeigniter slug, url

I have 4 controllers: Catalog, Contact, About, Main. On each controller, I want to set the individual URL from the database. The structure of the database page:

url_title|id_page|name_page|page_section|
about-us |   5   |  About  |    about   |

how can this be implemented, taking into account that the function will be also indicate the URL?

Upvotes: 0

Views: 278

Answers (1)

cartalot
cartalot

Reputation: 3148

the site url can be different then the controller name and optional method name.

in application/config/routes.php

$route['about-us'] = 'about';

so then website.com/about-us will 'route' to the about controller index method

if you want to specify a method in the about controller such as show()

$route['about-us'] = 'about/show';

Upvotes: 1

Related Questions