CodeIgniter Forums
CMS site url - Printable Version

+- CodeIgniter Forums (
+-- Forum: Using CodeIgniter (
+--- Forum: General Help (
+--- Thread: CMS site url (/showthread.php?tid=63581)

CMS site url - muthu - 11-16-2015


I working in CMS based website, in that i want show list of articles and magazines.

i referred some magazine site, here they are displaying

they're displaying article headline in the url. how they worked?

how to work with the cms site url?


RE: CMS site url - PaulD - 11-16-2015

If it is a CI site, the news method in the news controller is collecting the variable which in this case is the url friendly article name.

The news method would then look up the article title in the ULR column of the database, or worse, replace the - with spaces and checking the real title - something like that anyway.

Hope that helps,


RE: CMS site url - ivantcholakov - 11-16-2015


First, why:
Search the internet with the word pair CodeIgniter permalink
For generation of the corresponding slugs the function url_title() might help you. For slugs derived from non-English, maybe you will have to consider to apply transliteration to ASCII first.

Slug generation could be automatic, human touch could be added also. New generated slugs should be checked for uniqueness and modified when it is needed to avoid collision.

If your site is going to be multi-lingual, see this discussion: My personal choice is different slugs for translated pages (plus the language segment).

About how to store the relations page_id <-> slugs: Most of the solutions I've see rely on manipulation of routes.php. There data could be taken from a preliminary generated file or from database. Other possible way which I use is extension of the CodeIgniter's router class, reading from the database, and implementation of the lookup logic there.

Links like would simplify the logic, because the page_id is included, but for my needs I avoid them, because I don't consider them as permalinks. I prefer links without page_id like this one:

Good luck.

RE: CMS site url - ivantcholakov - 11-16-2015


Since implementation of such feature is relatively complex, explanation practically is not enough. Take this CMS of mine and see how the permalinks/slugs work:
Someday I am going to publish it on GitHub under the MIT license, when I get satisfied with code quality and features.