views:

150

answers:

4

Hi,

I want to program in the CodeIgniter few domain and 2 admins under a linux machine.

one.com two.com three.com ....com

and in addition to i need two backend systems.

reports cms

only few things are similar between the domains. and can be shared what is the best folder structures for that?

after you suggest your structure, how do i do it in the router and in the index.php. i read some articles but none of them explain it so it can be doable for a newbie.

thanks

A: 

Hi,

If there is just few things in common why you don't install one instance of Codeigniter for each domain?

But if you want to have just one Codeigniter instance, so I recomend that you create one main controller per domain (controller_domain1,...,controller_domainX), and separate the views in subfolders like (domain1,domain2,domain3).

Regards,
Pedro

Pedro
A: 

I would also recommend using a different installation of Codeigniter for each domain. However, if you do want to use just one installtion for different applications then the user guide explains how here:
Managing your applications: CodeIgniter User Guide

musoNic80
Fully agree, a shared CI system sounds nice in theory, but can possibly bite you in the ass later. If you upgrade to a newer version of CI, you cannot do it once application at a time anymore. Also, you cannot make app-specific customizations. Although those should be avoided, sometimes they are needed.
Ferdy
A: 

This is what you need to do:

  1. Move the "system" folder up one directory.

    old folder structure: www\codeignitor\application\system to: www\codeignitor\system

  2. Change the $system_folder in the index.php = "system"; variable in index.php to point one level up.

Doing this allows you to share the system folder and you can have many application folders.

In config.php

    $system_folder = "system";
    To:
    $system_folder = "../system";

For extra security you may rename the system folder to something else people can't guess or move the system folder two levels up to your home directory.

Yada
+3  A: 
/var/www-virtual
    | -- /system  
    |    |-- /cache
    |    |-- ...
    |
    | -- /apps
    |     | -- /one.com
    |     |    | -- /config
    |     |    | -- /controllers
    |     |    | -- ...
    |     | -- /two.com
    |     |    | -- /config
    |     |    | -- /controllers
    |     |    | -- ...
    |
    | -- /public  
    |    | -- /one.com
    |    |    | -- /index.php
    |    |    | -- /css
    |    |    | -- ...
    |    | -- /two.com
    |    |    | -- /index.php
    |    |    | -- /css
    |    |    | -- ...

This is how I rig it. Each virtual host points at /var/www-virtual/public/??.com and in each /var/www-virtual/public/??.com/index.php I have...

$system_folder = "../../system";
$application_folder = "../../apps/??.com";

Hope that makes sense.

mtvee