CodeIgniter Forums

Full Version: How use route in Codeigniter
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

Hi all.
I have a link as
Now I want to use route to change this link to as like:
But I dont know how to code, who can help me? Thank a lot

El Forum

ok in the 1st link you are looking for the article by id or month or whatever (12), and title (abc) in the databse.
the basic idea is to have another column called for eg: slug in the article table populated at the entry point of the article, that will utilize url_title(); see

$article_title = 'your article title';
$slug = url_title($article_title);
//save this value to the column

then in reading time, you can look up the article by the slug , take the article title list it in an anchor or whatever with the link

hope this help.

El Forum

@weboap: thank you but I mean that link with "article" is a controller, and now I want to change it to, it's mean change controller "article" to "bai-viet"
I was trying use to Regular Expressions ([a-zA-Z0-9_-]+) to do but not successfully

El Forum


"Typically there is a one-to-one relationship between a URL string and its corresponding controller class/method. The segments in a URI normally follow this pattern:

In some instances, however, you may want to remap this relationship so that a different class/function can be called instead of the one corresponding to the URL."

mean the controller "bai-vet-12-abc" need to exist???!! , you can check " _remap " but i don't think its gonna do it either.
I'm interested too to see if somebody have any idea....