Welcome Guest, Not a member yet? Register   Sign In
Custom CMS URI's?
#1

[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
#2

[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?
#3

[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.
#4

[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
#5

[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.




Theme © iAndrew 2016 - Forum software by © MyBB