[eluser]Buso[/eluser]
[quote author="isabelle" date="1194658717"]Hy all,
I've read the doc about using CI for more than one application but i'm wondering how to display the right website dynamicly.
I now i have to specify the application folder in the index file but if i have different domain names, do i have to check the uri?
like this :
Code:
if($_SERVER["REQUEST_URI"] == "theadress"){
$application_folder = "application/repertory";
}
else if(...)
{
...
}
It works for two or three applications but for more, is there a specific way to work like that? (the applications are created manually, not dynamicly like blogs)
Thanks in advance for your reply,[/quote]
I use something like this, I hope it makes sense:
Code:
// extra apps
$applications = array(
array('site' => 'app2', 'uri' => '/uri2'),
array('site' => 'app3' , 'domain' => 'mydomain3.com')
);
$application_folder = "../application";
foreach($applications AS $a) {
if(isset($a['uri'])) {
if( 0 === stripos($_SERVER['REQUEST_URI'], $a['uri']) ) {
$application_folder = "../application_" . $a['site'];
}
} else if(isset($a['domain'])) {
if( 0 === stripos($_SERVER['SERVER_NAME'],$a['domain'])) {
$application_folder = "../application_" . $a['site'];
}
}
}
for more apps, I just add them to the array, with the corresponding uri or domain. Then in config.php you have to make the base_url fit this
you could add an 'application_folder' key to the array if you want different names for the folders. I just feel that using the 'application_' prefix is more tidy