CodeIgniter Forums
Custom CMS URI's? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Custom CMS URI's? (/showthread.php?tid=42827)



Custom CMS URI's? - El Forum - 06-21-2011

[eluser]Steve Goodwin[/eluser]
Hi All,

Forgive me if this has been answered before, I have seen a few forums posts relating to this, but none have answered the question simply.

I'm new to CI and am looking to move to this framework for all of my work, I currently have my own custom CMS and the URI's are all checked via a database and the relevant template & content returned and served up to the user.

From what I can see I cannot currently see how I would create the url:

www.example.com/about-us/company/team/

If I have a database of URI's which are always being added to and some permanent functionality such as a shop checkout, how would I get CI to route URI's through a database table instead of the MVC pattern it uses out of the box.

I've also tried to see how pyro CMS does this, but not knowing enough about CI or Pyro was meaning I couldn't find a simple answer.

Thanks in advance

Steve


Custom CMS URI's? - El Forum - 06-21-2011

[eluser]Wonder Woman[/eluser]
Have you checked out the routes.php file in your config folder? You can set it up there so if a user goes to http://www.example.com/about-us/company/team/ you can determine what controller is used...for example if a user goes to http://www.example.com/news/article-title/ then it will go to my news function inside my news controller by setting this up in routes.php:

Code:
$route['news/(:any)'] = 'news/article';

I don't know if this is what you were looking for?


Custom CMS URI's? - El Forum - 06-21-2011

[eluser]Steve Goodwin[/eluser]
Hi Thanks for your quick reply,

Yeah I've currently had a play with this method, but wasn't sure if this was the right way, as i want to route all requests through a new routing controller, but wasn't sure if doing it this way:

Code:
$route['shop/(:any)'] = 'shop';
$route[':any'] = 'content/pages';

I wasn't sure if this was the correct way to do this, as Pyro CMS looks a lot more involved, but I don't want something this fully featured and I'd rather learn CI through a proper project.


Custom CMS URI's? - El Forum - 06-21-2011

[eluser]Wonder Woman[/eluser]
If I'm honest, I've only just started dabbling with routes and I have been doing something similar, no doubt there is a different way to achieve this but if it works then I shouldn't see any problems in doing it this way. From what I have read it appears that most people do this anyways Smile


Custom CMS URI's? - El Forum - 06-21-2011

[eluser]toopay[/eluser]
In CI, theres several way you can manipulate and deals with uri. I'm personally will put Route configuration, at very last lines. I prefer to use a _remap function or seting up a hook for that.