Welcome Guest, Not a member yet? Register   Sign In
routing problem / url aliasing
#1

[eluser]Unknown[/eluser]
Hi

Here's my routing problem, hope you can help.

I want the URL http://site.fr/SEGMENT to load a controller like categories/category/CATEGORY_ID

The connexion between the SEGMENT and the CATEGORY_ID is stored in the database.

I tried a pre_controller hook but i can not load my model and other needed stuffs.
Tried to write a library, same problem.

I also tried the _remap() function in my default_controller but it's not working because i have i18n library : http://codeigniter.com/wiki/I18N_Library which needs these routes :
$route['^fr/(.+)$'] = "$1";
$route['^en/(.+)$'] = "$1";
$route['^fr$'] = $route['default_controller'];
$route['^en$'] = $route['default_controller'];

Thanks
ww
#2

[eluser]Narkboy[/eluser]
I had a similar issue a while ago trying to get a single CI to handle calls to multiple TLDs and subdomains. Long story short, don't try to put controllers in more than one sub-folder level. It's just not pretty. I used Apaches mod_rewrite to solve the issue rather than try to hook in.

Two links:

http://ellislab.com/forums/viewthread/152385/ <-- getting around large numbers of controllers

http://ellislab.com/forums/viewthread/152234/ <-- mod_rewrite for complex routing

The other option you have is to use a config file to store the segment <-> cat_id associations rather than a db.

/B




Theme © iAndrew 2016 - Forum software by © MyBB