Welcome Guest, Not a member yet? Register   Sign In
Routes question
#1

[eluser]Azrael91[/eluser]
My website loads pages from a 'webshop' class, with a 'pages' function, so the links are "website/webshop/pages/category". How can i change it to "website/category" ? Tried lots of ways from routes.php. Any ideea ?

Thanks
#2

[eluser]Aken[/eluser]
Code:
$routes['(:any)'] = 'webshop/pages/$1';

You may want to reconsider having a single controller function serving all your pages, though. It makes your code more complicated, less compartmentalized and just more difficult in general.
#3

[eluser]Azrael91[/eluser]
I'm using backendpro cms, and that's how it's structured Tongue. I tried what you said but it always takes me to the main index. As a matter of fact the URL is website.com/index.php/webshop/pages/category and it routes to website.com/index.php.
#4

[eluser]Aken[/eluser]
Does your pages function have a redirect, where it sends you to the homepage if it fails to find something appropriate? If so, try disabling it and see if it still redirects you. If not, you know it's just an issue with the controller and you can narrow it down from there.
#5

[eluser]Azrael91[/eluser]
[quote author="Aken" date="1310990056"]
Code:
$routes['(:any)'] = 'webshop/pages/$1';

You may want to reconsider having a single controller function serving all your pages, though. It makes your code more complicated, less compartmentalized and just more difficult in general.[/quote]

I don't know why it didn't work ar first ... now it does Smile. Another quick question:

This conflicts ... is there any other way ?
Code:
$route['(:any)'] = 'webshop/produse/$1';
$route['(:any)'] = 'webshop/pages/$1';
#6

[eluser]Aken[/eluser]
The way routes work is that as soon as it finds a matching route, it will send it, regardless of what is after. So with that set up, your URLs will never route to webshop/pages/$1.

You need to differentiate between those two somehow. Like any "produse" calls will need to have something in the route to specify that it's a produse call.
Code:
$routes['produse/(:any)'] = 'webshop/produse/$1';
$routes['(:any)'] = 'webshop/pages/$1';
#7

[eluser]Azrael91[/eluser]
Yeah ... I thought it might be like that Smile
Thanks




Theme © iAndrew 2016 - Forum software by © MyBB