Welcome Guest, Not a member yet? Register   Sign In
Routing Question(s)
#1

[eluser]drakeonfire[/eluser]
Hello,

I've been pondering how to do some routing for a rather large system, and wanted to try and keep it as minimal as possible.

So, I was hoping that you may be able to answer some of my questions.

1) I noticed someone using code like this on the forum in a route, is this right and can anyone explain more? From what I understand it means you don't have to do each one seperately.
Code:
$route['(home/contact/about)'] = 'main/$1';

2) If the system I'm building is built off of a CMS, and the user adds pages etc, most of the page urls are not going to be known, but need to be at the root 'url', e.g. example.com/my_new_page

How can I effectively direct that to the correct page, when there's also going to be things like categories, sub categories, products etc (categories would be at the root, e.g. example.com/fruit)

As from what I can tell, I can't use a simple :any or reg xp to do it, as I'm not going to know if it's a page or a category!?


That's all for now ... Thank you.
#2

[eluser]InsiteFX[/eluser]
Code:
$route['home/contact/about/(:any)'] = 'main/$1';

CodeIgniter User Guide - URI Routing
#3

[eluser]drakeonfire[/eluser]
Hello,

Thanks for the reply.

I've read the URI Routing documentation quite a few times, and felt it was slightly lacking if I'm honest!

So essentially what you've provided me is making all links go to the main controller? But some pages themselves won't actually have methods (e.g. user created pages). Should I just set up some kind of custom route method in my main controller to choose where stuff goes?
#4

[eluser]drakeonfire[/eluser]
Any one Smile?




Theme © iAndrew 2016 - Forum software by © MyBB