Multi route file |
[eluser]guitarlove[/eluser]
Hello, I trying to make a multi site based on the same code. I done with the parent/child hierachy by making a parent general controller and with the cild a specify the unique fonction for the new site. I redirect to the good controller with the config file by checking the site url. Like this http://philsturgeon.co.uk/blog/2009/06/H...ter-Set-up But I got a problem and I didn't find a solution. I want to make a routing file per site. Example, Code: Site 1 => site1_route Is this possible to have multiple route file in the config file ? My second idear was to make a module per new website and including the parent controller, so in fact they use the same code. thank
[eluser]guitarlove[/eluser]
I got a new idear, but I don't know if it's a "clean" way to do it. I make my own route file MY_Route that extends CI_Router. I just rewrite the function _set_routing, now she take $this->route_file_name. Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
[eluser]PhilTem[/eluser]
Why don't you just include multiple routes.php files that are stored in folders according to some slug you gave the pages? o.O
[eluser]guitarlove[/eluser]
[quote author="PhilTem" date="1353085099"]Why don't you just include multiple routes.php files that are stored in folders according to some slug you gave the pages? o.O[/quote] It will sound stupid (maybe of my bad english), but I don't know how you can include multiple route file ? Also,my situation updated. For the moment, the codeigniter project, use de modular extension system HMVC. What I need to do is, for a specific website the good route are loading. Like I said in my first post, for the multiple site, I use a parent/child hierarchy because for the part of the front, i can't use the modular or copy some code. So, i check the url and I want to redirecte to the good route file. But Now, in this route file, I must take the translation for the url. Exemple fr.jesuisunepatate.fr will be eng.iamapotato.com like $route['test'] = _("My string"); I use getText and PO file, but how I can let codeigniter do this ? thank
[eluser]guitarlove[/eluser]
I found a solution. For people that will have the same problem, if you use HMVC like me, you juste need to add this line Code: require 'site_add.php'; $route_file_name (initialised in site_add.php) Code: /** Parse module routes **/ I put the code to detect the URL in a another file. It name is site_add like you can see up there. Code: switch ($_SERVER['HTTP_HOST']) { |
Welcome Guest, Not a member yet? Register Sign In |